PathChooser: Provide more direct access to button label

Change-Id: I1489f40432acd3b70cedac6aded40738dddca941
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
hjk
2014-02-19 14:46:19 +01:00
parent 960725da5d
commit 9cbee15341
4 changed files with 9 additions and 11 deletions

View File

@@ -52,13 +52,6 @@
This class has some validation logic for embedding into QWizardPage.
*/
const char * const Utils::PathChooser::browseButtonLabel =
#ifdef Q_OS_MAC
QT_TRANSLATE_NOOP("Utils::PathChooser", "Choose...");
#else
QT_TRANSLATE_NOOP("Utils::PathChooser", "Browse...");
#endif
namespace Utils {
// ------------------ PathValidatingLineEdit
@@ -251,7 +244,7 @@ PathChooser::PathChooser(QWidget *parent) :
d->m_hLayout->addWidget(d->m_lineEdit);
d->m_hLayout->setSizeConstraint(QLayout::SetMinimumSize);
addButton(tr(browseButtonLabel), this, SLOT(slotBrowse()));
addButton(browseButtonLabel(), this, SLOT(slotBrowse()));
setLayout(d->m_hLayout);
setFocusProxy(d->m_lineEdit);
@@ -278,6 +271,11 @@ void PathChooser::insertButton(int index, const QString &text, QObject *receiver
d->m_buttons.insert(index, button);
}
QString Utils::PathChooser::browseButtonLabel()
{
return HostOsInfo::isMacHost() ? tr("Choose...") : tr("Browse...");
}
QAbstractButton *PathChooser::buttonAtIndex(int index) const
{
return d->m_buttons.at(index);