22 #include <QHBoxLayout> 31 , mDuration( duration )
33 , mUserIcon(
QIcon() )
44 , mDuration( duration )
46 , mUserIcon(
QIcon() )
57 , mDuration( duration )
59 , mUserIcon(
QIcon() )
70 , mDuration( duration )
72 , mUserIcon(
QIcon() )
82 void QgsMessageBarItem::writeContent()
95 mLblIcon =
new QLabel(
this );
105 QString msgIcon(
"/mIconInfo.png" );
109 msgIcon =
QString(
"/mIconCritical.png" );
112 msgIcon =
QString(
"/mIconWarning.svg" );
115 msgIcon =
QString(
"/mIconSuccess.png" );
139 mTextEdit->
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum );
144 mTextEdit->
setStyleSheet(
"QTextEdit { background-color: rgba(0,0,0,0); margin-top: 0.25em; max-height: 1.75em; min-height: 1.75em; } " 145 "QScrollBar { background-color: rgba(0,0,0,0); } " 146 "QScrollBar::add-page,QScrollBar::sub-page,QScrollBar::handle { background-color: rgba(0,0,0,0); color: rgba(0,0,0,0); } " 147 "QScrollBar::up-arrow,QScrollBar::down-arrow { color: rgb(0,0,0); } " );
166 if ( !item || item->
widget() != mWidget )
175 mStyleSheet =
"QgsMessageBar { background-color: #dff0d8; border: 1px solid #8e998a; } " 176 "QLabel,QTextEdit { color: black; } ";
180 mStyleSheet =
"QgsMessageBar { background-color: #d65253; border: 1px solid #9b3d3d; } " 181 "QLabel,QTextEdit { color: white; } ";
185 mStyleSheet =
"QgsMessageBar { background-color: #ffc800; border: 1px solid #e0aa00; } " 186 "QLabel,QTextEdit { color: black; } ";
190 mStyleSheet =
"QgsMessageBar { background-color: #e7f5fe; border: 1px solid #b9cfe4; } " 191 "QLabel,QTextEdit { color: #2554a1; } ";
193 mStyleSheet +=
"QLabel#mItemCount { font-style: italic; }";
223 item = mLayout->
itemAt( 2 );
224 if ( item->
widget() == mWidget )
void setContentsMargins(int left, int top, int right, int bottom)
void setFrameShape(Shape)
QString & prepend(QChar ch)
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
void setPixmap(const QPixmap &)
int duration() const
returns the duration in second of the message
QgsMessageBar::MessageLevel level()
returns the level
QPixmap pixmap(const QSize &size, Mode mode, State state) const
QgsMessageBarItem * setTitle(const QString &title)
QgsMessageBarItem * setWidget(QWidget *widget)
QgsMessageBarItem * setText(const QString &text)
QgsMessageBarItem * setIcon(const QIcon &icon)
QgsMessageBarItem(const QString &text, QgsMessageBar::MessageLevel level=QgsMessageBar::INFO, int duration=0, QWidget *parent=nullptr)
make out a widget containing a message to be displayed on the bar
void setObjectName(const QString &name)
virtual QLayoutItem * itemAt(int index) const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
QgsMessageBarItem * setLevel(QgsMessageBar::MessageLevel level)
QgsMessageBarItem * setDuration(int duration)
void setReadOnly(bool ro)
void styleChanged(const QString &styleSheet)
emitted when the message level has changed
void setText(const QString &text)