Browse Source

Allow to set placeholder for FileSystemPathEdit

adaptive-webui-19844
Vladimir Golovnev (Glassez) 3 years ago
parent
commit
b0e41abf5a
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7
  1. 12
      src/gui/fspathedit.cpp
  2. 3
      src/gui/fspathedit.h
  3. 20
      src/gui/fspathedit_p.cpp
  4. 6
      src/gui/fspathedit_p.h

12
src/gui/fspathedit.cpp

@ -247,6 +247,18 @@ void FileSystemPathEdit::setFileNameFilter(const QString &val)
#endif #endif
} }
QString FileSystemPathEdit::placeholder() const
{
Q_D(const FileSystemPathEdit);
return d->m_editor->placeholder();
}
void FileSystemPathEdit::setPlaceholder(const QString &val)
{
Q_D(FileSystemPathEdit);
d->m_editor->setPlaceholder(val);
}
bool FileSystemPathEdit::briefBrowseButtonCaption() const bool FileSystemPathEdit::briefBrowseButtonCaption() const
{ {
Q_D(const FileSystemPathEdit); Q_D(const FileSystemPathEdit);

3
src/gui/fspathedit.h

@ -71,6 +71,9 @@ public:
QString fileNameFilter() const; QString fileNameFilter() const;
void setFileNameFilter(const QString &val); void setFileNameFilter(const QString &val);
QString placeholder() const;
void setPlaceholder(const QString &val);
/// The browse button caption is "..." if true, and "Browse" otherwise /// The browse button caption is "..." if true, and "Browse" otherwise
bool briefBrowseButtonCaption() const; bool briefBrowseButtonCaption() const;
void setBriefBrowseButtonCaption(bool brief); void setBriefBrowseButtonCaption(bool brief);

20
src/gui/fspathedit_p.cpp

@ -240,6 +240,16 @@ void Private::FileLineEdit::setValidator(QValidator *validator)
QLineEdit::setValidator(validator); QLineEdit::setValidator(validator);
} }
QString Private::FileLineEdit::placeholder() const
{
return placeholderText();
}
void Private::FileLineEdit::setPlaceholder(const QString &val)
{
setPlaceholderText(val);
}
QWidget *Private::FileLineEdit::widget() QWidget *Private::FileLineEdit::widget()
{ {
return this; return this;
@ -346,6 +356,16 @@ void Private::FileComboEdit::setValidator(QValidator *validator)
lineEdit()->setValidator(validator); lineEdit()->setValidator(validator);
} }
QString Private::FileComboEdit::placeholder() const
{
return lineEdit()->placeholderText();
}
void Private::FileComboEdit::setPlaceholder(const QString &val)
{
lineEdit()->setPlaceholderText(val);
}
void Private::FileComboEdit::setFilenameFilters(const QStringList &filters) void Private::FileComboEdit::setFilenameFilters(const QStringList &filters)
{ {
static_cast<FileLineEdit *>(lineEdit())->setFilenameFilters(filters); static_cast<FileLineEdit *>(lineEdit())->setFilenameFilters(filters);

6
src/gui/fspathedit_p.h

@ -105,6 +105,8 @@ namespace Private
virtual void setFilenameFilters(const QStringList &filters) = 0; virtual void setFilenameFilters(const QStringList &filters) = 0;
virtual void setBrowseAction(QAction *action) = 0; virtual void setBrowseAction(QAction *action) = 0;
virtual void setValidator(QValidator *validator) = 0; virtual void setValidator(QValidator *validator) = 0;
virtual QString placeholder() const = 0;
virtual void setPlaceholder(const QString &val) = 0;
virtual QWidget *widget() = 0; virtual QWidget *widget() = 0;
}; };
@ -121,6 +123,8 @@ namespace Private
void setFilenameFilters(const QStringList &filters) override; void setFilenameFilters(const QStringList &filters) override;
void setBrowseAction(QAction *action) override; void setBrowseAction(QAction *action) override;
void setValidator(QValidator *validator) override; void setValidator(QValidator *validator) override;
QString placeholder() const override;
void setPlaceholder(const QString &val) override;
QWidget *widget() override; QWidget *widget() override;
protected: protected:
@ -149,6 +153,8 @@ namespace Private
void setFilenameFilters(const QStringList &filters) override; void setFilenameFilters(const QStringList &filters) override;
void setBrowseAction(QAction *action) override; void setBrowseAction(QAction *action) override;
void setValidator(QValidator *validator) override; void setValidator(QValidator *validator) override;
QString placeholder() const override;
void setPlaceholder(const QString &val) override;
QWidget *widget() override; QWidget *widget() override;
protected: protected:

Loading…
Cancel
Save