diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/widgets/mcombobox.cpp | 10 | ||||
-rw-r--r-- | src/corelib/widgets/mcombobox.h | 29 | ||||
-rw-r--r-- | src/corelib/widgets/mcomboboxmodel.h | 7 | ||||
-rw-r--r-- | src/corelib/widgets/mcontentitem.cpp | 10 | ||||
-rw-r--r-- | src/corelib/widgets/mcontentitem_p.h | 1 | ||||
-rw-r--r-- | src/corelib/widgets/mcontentitemmodel.h | 7 |
6 files changed, 56 insertions, 8 deletions
diff --git a/src/corelib/widgets/mcombobox.cpp b/src/corelib/widgets/mcombobox.cpp index 262c17dc..ce6bfb7e 100644 --- a/src/corelib/widgets/mcombobox.cpp +++ b/src/corelib/widgets/mcombobox.cpp @@ -183,6 +183,11 @@ QString MComboBox::title() const return model()->title(); } +bool MComboBox::isProgressIndicatorVisible() const +{ + return model()->progressIndicatorVisible(); +} + void MComboBox::addItem(const QString &text) { insertItem(count(), text); @@ -351,6 +356,11 @@ void MComboBox::setTitle(const QString &title) model()->setTitle(title); } +void MComboBox::setProgressIndicatorVisible(bool enable) +{ + model()->setProgressIndicatorVisible(enable); +} + void MComboBox::setCurrentIndex(int index) { if (index == currentIndex()) return; diff --git a/src/corelib/widgets/mcombobox.h b/src/corelib/widgets/mcombobox.h index 7d777603..d09c6e75 100644 --- a/src/corelib/widgets/mcombobox.h +++ b/src/corelib/widgets/mcombobox.h @@ -94,6 +94,12 @@ class M_EXPORT MComboBox : public MWidgetController Q_PROPERTY(QString title READ title WRITE setTitle) /*! + \property MComboBox::progressIndicatorVisible + \brief See MComboBoxModel::progressIndicatorVisible + */ + Q_PROPERTY(bool progressIndicatorVisible READ isProgressIndicatorVisible WRITE setProgressIndicatorVisible ) + + /*! \property MComboBox::itemModel QAbstractItemModel which used by MComboBox */ Q_PROPERTY(QAbstractItemModel *itemModel READ itemModel WRITE setItemModel) @@ -169,6 +175,11 @@ public: */ QString title() const; + /*! + \brief Returns true if progress indicator is visible + */ + bool isProgressIndicatorVisible() const; + /** \brief Adds an item to the combobox with the given \a text. The item is appended to the list of existing items. @@ -301,6 +312,24 @@ public Q_SLOTS: */ void setTitle(const QString &title); + /*! + \brief shows\hides progress indicator + */ + void setProgressIndicatorVisible(bool visible); + + /*! + \brief shows progress indicator + */ + inline void showProgressIndicator() { + setProgressIndicatorVisible(true); + } + /*! + \brief hides progress indicator + */ + inline void hideProgressIndicator() { + setProgressIndicatorVisible(false); + } + /** \brief Set current index */ diff --git a/src/corelib/widgets/mcomboboxmodel.h b/src/corelib/widgets/mcomboboxmodel.h index 5711b4a2..a057cda5 100644 --- a/src/corelib/widgets/mcomboboxmodel.h +++ b/src/corelib/widgets/mcomboboxmodel.h @@ -57,6 +57,13 @@ class M_EXPORT MComboBoxModel : public MWidgetModel M_MODEL_PROPERTY(QString, title, Title, true, QString()) /*! + \property MComboBoxModel::progressIndicatorVisible + \brief Boolean value that defines whether a progress indicator is visible or not. + If the progress indicator is visible, a subtitle is hidden. + */ + M_MODEL_PROPERTY(bool, progressIndicatorVisible, ProgressIndicatorVisible, true, false) + + /*! \property MComboBoxModel::itemModel \brief QAbstractItemModel which used by MComboBox */ diff --git a/src/corelib/widgets/mcontentitem.cpp b/src/corelib/widgets/mcontentitem.cpp index 211f33f8..10b64829 100644 --- a/src/corelib/widgets/mcontentitem.cpp +++ b/src/corelib/widgets/mcontentitem.cpp @@ -31,7 +31,6 @@ M_REGISTER_WIDGET(MContentItem) MContentItemPrivate::MContentItemPrivate(): MWidgetControllerPrivate(), - additionalItem(0), smallItem(0) { } @@ -159,23 +158,20 @@ QImage MContentItem::optionalImage() const void MContentItem::setAdditionalItem(MWidget* widget) { - Q_D(MContentItem); - d->additionalItem = widget; + model()->setAdditionalItem(widget); } MWidget* MContentItem::additionalItem() const { - Q_D(const MContentItem); - return d->additionalItem; + return model()->additionalItem(); } void MContentItem::enableProgressBar() { - Q_D(MContentItem); MProgressIndicator* progressIndicator = new MProgressIndicator; progressIndicator->setViewType(MProgressIndicator::barType); progressIndicator->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Expanding); - d->additionalItem = progressIndicator; + model()->setAdditionalItem(progressIndicator); } void MContentItem::setSmallItem(MWidget* widget) diff --git a/src/corelib/widgets/mcontentitem_p.h b/src/corelib/widgets/mcontentitem_p.h index 0af0d937..e5e6cfe3 100644 --- a/src/corelib/widgets/mcontentitem_p.h +++ b/src/corelib/widgets/mcontentitem_p.h @@ -34,7 +34,6 @@ public: QImage image; QPixmap optionalPixmap; QImage optionalImage; - MWidget* additionalItem; MWidget* smallItem; }; diff --git a/src/corelib/widgets/mcontentitemmodel.h b/src/corelib/widgets/mcontentitemmodel.h index 9ac49782..b65392d0 100644 --- a/src/corelib/widgets/mcontentitemmodel.h +++ b/src/corelib/widgets/mcontentitemmodel.h @@ -94,6 +94,13 @@ public: \brief Contains optional icon on the right-hand side */ M_MODEL_PROPERTY(QImage, optionalImage, OptionalImage, false, QImage()) + + /*! + \property MContentItemModel::additionalItem + \brief MWidget as e.g. progress bar, visible below the title. + In case there is already a subtitle it will be replaced. + */ + M_MODEL_PTR_PROPERTY(MWidget*, additionalItem, AdditionalItem, true, NULL) }; #endif |