Skip to content
Permalink
Browse files

Add GUI_Export, Reorder widgets

  • Loading branch information
NathanW2 committed Aug 15, 2013
1 parent 3fdeb03 commit 05a41e339291f14f031ca81294204327ee806746
Showing with 33 additions and 41 deletions.
  1. +32 −40 src/gui/qgsmessagebaritem.cpp
  2. +1 −1 src/gui/qgsmessagebaritem.h
@@ -94,6 +94,35 @@ void QgsMessageBarItem::writeContent()
mLblIcon = 0;
}

// ICON
if ( mLblIcon == 0 )
{
mLblIcon = new QLabel( this );
mLayout->addWidget( mLblIcon );
}
QIcon icon;
if ( !mUserIcon.isNull() )
{
icon = mUserIcon;
}
else
{
QString msgIcon( "/mIconInfo.png" );
switch ( mLevel )
{
case QgsMessageBar::CRITICAL:
msgIcon = QString( "/mIconCritical.png" );
break;
case QgsMessageBar::WARNING:
msgIcon = QString( "/mIconWarn.png" );
break;
default:
break;
}
icon = QgsApplication::getThemeIcon( msgIcon );
}
mLblIcon->setPixmap( icon.pixmap( 24 ) );

// TITLE AND TEXT
if ( mTitle.isEmpty() && mText.isEmpty() )
{
@@ -133,47 +162,13 @@ void QgsMessageBarItem::writeContent()
// WIDGET
if ( mWidget != 0 )
{
int idx = 0;
if ( mTextEdit != 0 )
idx = 1;

QLayoutItem *item = mLayout->itemAt( idx );
QLayoutItem *item = mLayout->itemAt( 2 );
if ( !item || item->widget() != mWidget )
{
mLayout->insertWidget( idx, mWidget );
mLayout->addWidget( mWidget );
}
}

// ICON
if ( mLblIcon == 0 )
{
mLblIcon = new QLabel( this );
mLayout->addWidget( mLblIcon );
}
QIcon icon;
if ( !mUserIcon.isNull() )
{
icon = mUserIcon;
}
else
{
QString msgIcon( "/mIconInfo.png" );
switch ( mLevel )
{
case QgsMessageBar::CRITICAL:
msgIcon = QString( "/mIconCritical.png" );
break;
case QgsMessageBar::WARNING:
msgIcon = QString( "/mIconWarn.png" );
break;
default:
break;
}
icon = QgsApplication::getThemeIcon( msgIcon );
}
mLblIcon->setPixmap( icon.pixmap( 24 ) );


// STYLESHEET
if ( mLevel >= QgsMessageBar::CRITICAL )
{
@@ -220,10 +215,7 @@ QgsMessageBarItem *QgsMessageBarItem::setWidget( QWidget *widget )
if ( mWidget != 0 )
{
QLayoutItem *item;
int idx = 0;
if ( mTextEdit != 0 )
idx = 1;
item = mLayout->itemAt( idx );
item = mLayout->itemAt( 2 );
if ( item->widget() == mWidget )
{
delete item->widget();
@@ -26,7 +26,7 @@
#include <QHBoxLayout>


class QgsMessageBarItem : public QWidget
class GUI_EXPORT QgsMessageBarItem : public QWidget
{
Q_OBJECT
public:

0 comments on commit 05a41e3

Please sign in to comment.
You can’t perform that action at this time.