24 #include <QStackedWidget>
25 #include <QProgressBar>
26 #include <QToolButton>
28 #include <QGridLayout>
30 #include <QMouseEvent>
34 : QFrame( parent ), mCurrentItem( NULL )
36 QPalette pal = palette();
37 pal.setBrush( backgroundRole(), pal.window() );
39 setAutoFillBackground(
true );
40 setFrameShape( QFrame::StyledPanel );
41 setFrameShadow( QFrame::Plain );
43 mLayout =
new QGridLayout(
this );
44 mLayout->setContentsMargins( 9, 1, 9, 1 );
48 mCountStyleSheet = QString(
"QProgressBar { border: 1px solid rgba(0, 0, 0, 75%);"
49 " border-radius: 2px; background: rgba(0, 0, 0, 0);"
50 " image: url(:/images/themes/default/%1) }"
51 "QProgressBar::chunk { background-color: rgba(0, 0, 0, 30%); width: 5px; }" );
56 mCountProgress->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
65 mItemCount->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
79 "QToolButton { background-color: rgba(0, 0, 0, 0); }"
80 "QToolButton::menu-button { background-color: rgba(0, 0, 0, 0); }" );
81 mCloseBtn->setCursor( Qt::PointingHandCursor );
83 mCloseBtn->setIconSize( QSize( 18, 18 ) );
84 mCloseBtn->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
86 mCloseBtn->setPopupMode( QToolButton::MenuButtonPopup );
107 if (
mCountProgress == childAt( e->pos() ) && e->button() == Qt::LeftButton )
133 QWidget *widget =
dynamic_cast<QWidget*
>(
mCurrentItem );
134 mLayout->removeWidget( widget );
136 disconnect(
mCurrentItem, SIGNAL( styleChanged( QString ) ),
this, SLOT( setStyleSheet( QString ) ) );
171 if ( existingItem == item )
173 mItems.removeOne( existingItem );
200 while (
mItems.count() > 0 )
214 disconnect(
mCurrentItem, SIGNAL( styleChanged( QString ) ),
this, SLOT( setStyleSheet( QString ) ) );
219 if (
mItems.contains( item ) )
230 mLayout->addWidget( item, 0, 1, 1, 1 );
241 connect(
mCurrentItem, SIGNAL( styleChanged( QString ) ),
this, SLOT( setStyleSheet( QString ) ) );
326 mCloseBtn->setPopupMode(
mItems.count() > 0 ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup );