diff --git a/krusader/Konfigurator/kgpanel.cpp b/krusader/Konfigurator/kgpanel.cpp --- a/krusader/Konfigurator/kgpanel.cpp +++ b/krusader/Konfigurator/kgpanel.cpp @@ -136,15 +136,16 @@ // ----------------- Tab Bar position ---------------------------------- auto *hbox = new QHBoxLayout(); - hbox->addWidget(new QLabel(i18n("Tab Bar position:"), groupBox)); + QLabel *labelTabBar = new QLabel(i18n("Tab Bar position:"), groupBox); + hbox->addWidget(labelTabBar); KONFIGURATOR_NAME_VALUE_PAIR positions[] = { { i18n("Top"), "top" }, { i18n("Bottom"), "bottom" } }; KonfiguratorComboBox *cmb = createComboBox("Look&Feel", "Tab Bar Position", - "bottom", positions, 2, groupBox, true, false, + "bottom", positions, 2, labelTabBar, groupBox, true, false, QString(), PAGE_GENERAL); hbox->addWidget(cmb); @@ -177,26 +178,28 @@ // -------------- Search bar position ----------------------- hbox = new QHBoxLayout(); - hbox->addWidget(new QLabel(i18n("Position:"), groupBox)); + QLabel *labelPosit = new QLabel(i18n("Position:"), groupBox); + hbox->addWidget(labelPosit); cmb = createComboBox("Look&Feel", "Quicksearch Position", - "bottom", positions, 2, groupBox, true, false, + "bottom", positions, 2, labelPosit, groupBox, true, false, QString(), PAGE_GENERAL); hbox->addWidget(cmb); hbox->addWidget(createSpacer(groupBox)); gridLayout->addLayout(hbox, 1, 0); // -------------- Default search mode ----------------------- hbox = new QHBoxLayout(); - hbox->addWidget(new QLabel(i18n("Default mode:"), groupBox)); + QLabel *labelMode = new QLabel(i18n("Default mode:"), groupBox); + hbox->addWidget(labelMode); KONFIGURATOR_NAME_VALUE_PAIR modes[] = { {i18n("Search"), QString::number(KrSearchBar::MODE_SEARCH)}, {i18n("Select"), QString::number(KrSearchBar::MODE_SELECT)}, {i18n("Filter"), QString::number(KrSearchBar::MODE_FILTER)}}; cmb = createComboBox("Look&Feel", "Default Search Mode", - QString::number(KrSearchBar::MODE_SEARCH), modes, 3, groupBox, true, false, - QString(), PAGE_GENERAL); - cmb->setToolTip(i18n("Set the default mode on first usage")); + QString::number(KrSearchBar::MODE_SEARCH), modes, 3, + labelMode, groupBox, true, false, + i18n("Set the default mode on first usage"), PAGE_GENERAL); hbox->addWidget(cmb); hbox->addWidget(createSpacer(groupBox)); gridLayout->addLayout(hbox, 1, 1); @@ -265,7 +268,7 @@ layouts[ i ].value = layoutNames[i]; } KonfiguratorComboBox *cmb = createComboBox("PanelLayout", "Layout", "default", - layouts, numLayouts, tab, true, false, + layouts, numLayouts, l, tab, true, false, QString(), PAGE_LAYOUT); grid->addWidget(cmb, 0, 1); delete [] layouts; @@ -279,7 +282,7 @@ { i18nc("Frame color", "Statusbar"), "Statusbar" } }; cmb = createComboBox("PanelLayout", "FrameColor", - "default", frameColor, 3, tab, true, false, + "default", frameColor, 3, l, tab, true, false, QString(), PAGE_LAYOUT); grid->addWidget(cmb, 1, 1); @@ -294,7 +297,7 @@ { i18nc("Frame shape", "Panel"), "Panel" }, }; cmb = createComboBox("PanelLayout", "FrameShape", - "default", frameShape, 4, tab, true, false, + "default", frameShape, 4, l, tab, true, false, QString(), PAGE_LAYOUT); grid->addWidget(cmb, 2, 1); @@ -309,7 +312,7 @@ { i18nc("Frame shadow", "Sunken"), "Sunken" }, }; cmb = createComboBox("PanelLayout", "FrameShadow", - "default", frameShadow, 4, tab, true, false, + "default", frameShadow, 4, l, tab, true, false, QString(), PAGE_LAYOUT); grid->addWidget(cmb, 3, 1); } @@ -321,14 +324,15 @@ // -------------------- Filelist icon size ---------------------------------- auto *hbox = new QHBoxLayout(); - hbox->addWidget(new QLabel(i18n("Default icon size:"), parent)); + QLabel *labelIconSize = new QLabel(i18n("Default icon size:"), parent); + hbox->addWidget(labelIconSize); auto *iconSizes = new KONFIGURATOR_NAME_VALUE_PAIR[KrView::iconSizes.count()]; for(int i = 0; i < KrView::iconSizes.count(); i++) iconSizes[i].text = iconSizes[i].value = QString::number(KrView::iconSizes[i]); KonfiguratorComboBox *cmb = createComboBox(instance->name(), "IconSize", _FilelistIconSize, - iconSizes, KrView::iconSizes.count(), parent, true, true, - QString(), PAGE_VIEW); + iconSizes, KrView::iconSizes.count(), labelIconSize, + parent, true, true, QString(), PAGE_VIEW); delete [] iconSizes; cmb->lineEdit()->setValidator(new QRegExpValidator(QRegExp("[1-9]\\d{0,1}"), cmb)); hbox->addWidget(cmb); @@ -423,16 +427,17 @@ hbox = new QHBoxLayout(); - hbox->addWidget(new QLabel(i18n("Sort method:"), panelGrp)); + QLabel *labelSort = new QLabel(i18n("Sort method:"), panelGrp); + hbox->addWidget(labelSort); KONFIGURATOR_NAME_VALUE_PAIR sortMethods[] = {{ i18n("Alphabetical"), QString::number(KrViewProperties::Alphabetical) }, { i18n("Alphabetical and numbers"), QString::number(KrViewProperties::AlphabeticalNumbers) }, { i18n("Character code"), QString::number(KrViewProperties::CharacterCode) }, { i18n("Character code and numbers"), QString::number(KrViewProperties::CharacterCodeNumbers) }, { i18nc("Krusader sort", "Krusader"), QString::number(KrViewProperties::Krusader) } }; KonfiguratorComboBox *cmb = createComboBox("Look&Feel", "Sort method", QString::number(_DefaultSortMethod), - sortMethods, 5, panelGrp, true, false, + sortMethods, 5, labelSort, panelGrp, true, false, QString(), PAGE_VIEW); hbox->addWidget(cmb); hbox->addWidget(createSpacer(panelGrp)); @@ -470,7 +475,8 @@ // -------------------- Default Panel Type ---------------------------------- hbox = new QHBoxLayout(); - hbox->addWidget(new QLabel(i18n("Default view mode:"), panelGrp)); + QLabel *labelViewMode = new QLabel(i18n("Default view mode:"), panelGrp); + hbox->addWidget(labelViewMode); QList views = KrViewFactory::registeredViews(); const int viewsSize = views.size(); @@ -488,8 +494,8 @@ } cmb = createComboBox("Look&Feel", "Default Panel Type", defType, - panelTypes, viewsSize, panelGrp, false, false, - QString(), PAGE_VIEW); + panelTypes, viewsSize, labelViewMode, panelGrp, + false, false, QString(), PAGE_VIEW); hbox->addWidget(cmb); hbox->addWidget(createSpacer(panelGrp)); @@ -704,7 +710,8 @@ tabLayout->addWidget(mediaMenuCheckBoxes, 0, nullptr); auto *showSizeHBox = new QHBoxLayout(); - showSizeHBox->addWidget(new QLabel(i18n("Show Size:"), tab)); + QLabel *labelShowSize = new QLabel(i18n("Show Size:"), tab); + showSizeHBox->addWidget(labelShowSize); KONFIGURATOR_NAME_VALUE_PAIR showSizeValues[] = { { i18nc("setting 'show size'", "Always"), "Always" }, { i18nc("setting 'show size'", "When Device has no Label"), "WhenNoLabel" }, @@ -714,7 +721,7 @@ createComboBox("MediaMenu", "ShowSize", "Always", showSizeValues, sizeof(showSizeValues) / sizeof(*showSizeValues), - tab, false, false, + labelShowSize, tab, false, false, QString(), PAGE_MEDIA_MENU); showSizeHBox->addWidget(showSizeCmb); createIgnoredMountpointsList(tab, tabLayout); diff --git a/krusader/Konfigurator/kgstartup.cpp b/krusader/Konfigurator/kgstartup.cpp --- a/krusader/Konfigurator/kgstartup.cpp +++ b/krusader/Konfigurator/kgstartup.cpp @@ -45,7 +45,6 @@ QString s = "

" + i18n("Defines the panel profile used at startup. A panel profile contains:<Last session> is a special panel profile which is saved automatically when Krusader is closed."); QLabel *label = addLabel(panelsGrid, 0, 0, i18n("Startup profile:"), panelsGrp); - label->setWhatsThis(s); panelsGrp->setWhatsThis(s); QStringList profileList = ProfileManager::availableProfiles("Panel"); @@ -57,7 +56,8 @@ comboItems[ i ].text = comboItems[ i ].value = profileList [ i ]; comboItems[ 0 ].value = ""; - profileCombo = createComboBox("Startup", "Starter Profile Name", comboItems[ 0 ].value, comboItems, profileListSize, panelsGrp, false, false); + profileCombo = createComboBox("Startup", "Starter Profile Name", comboItems[ 0 ].value, + comboItems, profileListSize, label, panelsGrp, false, false); profileCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); panelsGrid->addWidget(profileCombo, 0, 1); diff --git a/krusader/Konfigurator/konfiguratorpage.h b/krusader/Konfigurator/konfiguratorpage.h --- a/krusader/Konfigurator/konfiguratorpage.h +++ b/krusader/Konfigurator/konfiguratorpage.h @@ -259,6 +259,7 @@ * @param defaultValue The default value of the combobox * @param params Pointer to the name-value pair array (combo elements) * @param paramNum Number of the combobox elements + * @param label The label that is associated to the combobox * @param parent Reference to the parent widget * @param restart The change of this parameter requires Krusader restart * @param editable Flag indicates that the combo can be edited @@ -269,7 +270,7 @@ */ KonfiguratorComboBox *createComboBox(QString configGroup, QString name, QString defaultValue, KONFIGURATOR_NAME_VALUE_PAIR *params, int paramNum, - QWidget *parent = nullptr, bool restart = false, + QLabel *label, QWidget *parent = nullptr, bool restart = false, bool editable = false, const QString &toolTip = QString(), int page = FIRST_PAGE); diff --git a/krusader/Konfigurator/konfiguratorpage.cpp b/krusader/Konfigurator/konfiguratorpage.cpp --- a/krusader/Konfigurator/konfiguratorpage.cpp +++ b/krusader/Konfigurator/konfiguratorpage.cpp @@ -262,12 +262,14 @@ } KonfiguratorComboBox *KonfiguratorPage::createComboBox(QString configGroup, QString name, QString defaultValue, - KONFIGURATOR_NAME_VALUE_PAIR *params, int paramNum, QWidget *parent, bool restart, bool editable, - const QString &toolTip, int page) + KONFIGURATOR_NAME_VALUE_PAIR *params, int paramNum, QLabel *label, QWidget *parent, + bool restart, bool editable, const QString &toolTip, int page) { KonfiguratorComboBox *comboBox = new KonfiguratorComboBox(std::move(configGroup), std::move(name), std::move(defaultValue), params, paramNum, parent, restart, editable, page); if (!toolTip.isEmpty()) { + label->setWhatsThis(toolTip); + label->setToolTip(toolTip); comboBox->setWhatsThis(toolTip); comboBox->setToolTip(toolTip); }