UI: *Edit: Show Names from start

This commit is contained in:
Nodir Temirkhodjaev 2024-04-01 16:38:50 +03:00
parent 02fdbc9a4f
commit a37e7b821f
6 changed files with 17 additions and 8 deletions

View File

@ -9,9 +9,9 @@ ClickableMenu::ClickableMenu(QWidget *parent) : QMenu(parent)
void ClickableMenu::mousePressEvent(QMouseEvent *event)
{
QMenu::mousePressEvent(event);
m_pressed = true;
QMenu::mousePressEvent(event);
}
void ClickableMenu::mouseReleaseEvent(QMouseEvent *event)

View File

@ -4,6 +4,12 @@
LineEdit::LineEdit(QWidget *parent) : QLineEdit(parent) { }
void LineEdit::setStartText(const QString &v)
{
setText(v);
setCursorPosition(0);
}
bool LineEdit::event(QEvent *event)
{
switch (event->type()) {

View File

@ -10,6 +10,8 @@ class LineEdit : public QLineEdit
public:
explicit LineEdit(QWidget *parent = nullptr);
void setStartText(const QString &v);
bool event(QEvent *event) override;
};

View File

@ -155,7 +155,7 @@ void ProgramEditDialog::initializePathField(bool isSingleSelection, bool isPathE
void ProgramEditDialog::initializeNameField(bool isSingleSelection)
{
m_editName->setText(isSingleSelection ? m_appRow.appName : QString());
m_editName->setStartText(isSingleSelection ? m_appRow.appName : QString());
m_editName->setEnabled(isSingleSelection);
m_editName->setClearButtonEnabled(isSingleSelection);
@ -177,7 +177,7 @@ void ProgramEditDialog::initializeRuleField(bool isSingleSelection)
{
VariantUtil::setUserData(m_editRuleName, m_appRow.ruleId);
m_editRuleName->setText(isSingleSelection ? m_appRow.ruleName : QString());
m_editRuleName->setStartText(isSingleSelection ? m_appRow.ruleName : QString());
m_editRuleName->setEnabled(isSingleSelection);
m_editRuleName->setClearButtonEnabled(isSingleSelection);
@ -717,7 +717,7 @@ void ProgramEditDialog::fillEditName()
appName = IoC<AppInfoCache>()->appName(appPath);
}
m_editName->setText(appName);
m_editName->setStartText(appName);
}
bool ProgramEditDialog::save()
@ -860,7 +860,7 @@ void ProgramEditDialog::selectRuleDialog()
connect(rulesDialog, &RulesWindow::ruleSelected, this, [&](const RuleRow &ruleRow) {
VariantUtil::setUserData(m_editRuleName, ruleRow.ruleId);
m_editRuleName->setText(ruleRow.ruleName);
m_editRuleName->setStartText(ruleRow.ruleName);
});
}

View File

@ -44,7 +44,7 @@ void RuleEditDialog::initialize(const RuleRow &ruleRow)
retranslateUi();
m_editName->setText(ruleRow.ruleName);
m_editName->setStartText(ruleRow.ruleName);
m_editName->setClearButtonEnabled(true);
m_labelEditNotes->setPixmap(IconCache::file(":/icons/script.png"));
@ -260,6 +260,7 @@ QLayout *RuleEditDialog::setupRuleSetHeaderLayout()
{
m_btAddPresetRule = ControlUtil::createFlatToolButton(":/icons/add.png", [&] {
// TODO
m_ruleSetView->setVisible(true);
});
m_btRemovePresetRule = ControlUtil::createFlatToolButton(":/icons/delete.png", [&] {
// TODO

View File

@ -38,7 +38,7 @@ void ZoneEditDialog::initialize(const ZoneRow &zoneRow)
const QString sourceCode = isEmpty() ? ZoneSourceWrapper::textSourceCode() : zoneRow.sourceCode;
const ZoneSourceWrapper zoneSource(zoneListModel()->zoneSourceByCode(sourceCode));
m_editName->setText(zoneRow.zoneName);
m_editName->setStartText(zoneRow.zoneName);
m_comboSources->setCurrentIndex(zoneSource.index());
m_cbEnabled->setChecked(zoneRow.enabled);