Commit 04d7ece0 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Cleanup the ItemLibraryWidget

Change-Id: I4686ed5e5c218e1e37a189bdfc19cdb4ea4640f6
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent cf3e8163
......@@ -113,13 +113,15 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
tabBar->addTab(tr("Resources", "Title of library resources view"));
tabBar->addTab(tr("Imports", "Title of library imports view"));
tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_lineEdit = new Utils::FilterLineEdit(this);
m_lineEdit->setObjectName(QLatin1String("itemLibrarySearchInput"));
m_lineEdit->setPlaceholderText(tr("<Filter>", "Library search input hint text"));
m_lineEdit->setDragEnabled(false);
m_lineEdit->setMinimumWidth(75);
m_lineEdit->setTextMargins(0, 0, 20, 0);
connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(setCurrentIndexOfStackedWidget(int)));
connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(updateSearch()));
m_filterLineEdit = new Utils::FilterLineEdit(this);
m_filterLineEdit->setObjectName(QLatin1String("itemLibrarySearchInput"));
m_filterLineEdit->setPlaceholderText(tr("<Filter>", "Library search input hint text"));
m_filterLineEdit->setDragEnabled(false);
m_filterLineEdit->setMinimumWidth(75);
m_filterLineEdit->setTextMargins(0, 0, 20, 0);
QWidget *lineEditFrame = new QWidget(this);
lineEditFrame->setObjectName(QLatin1String("itemLibrarySearchInputFrame"));
QGridLayout *lineEditLayout = new QGridLayout(lineEditFrame);
......@@ -127,17 +129,13 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
lineEditLayout->setSpacing(0);
lineEditLayout->addItem(new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 0, 1, 3);
lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0);
lineEditLayout->addWidget(m_lineEdit.data(), 1, 1, 1, 1);
lineEditLayout->addWidget(m_filterLineEdit.data(), 1, 1, 1, 1);
lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 2);
connect(m_lineEdit.data(), SIGNAL(filterChanged(QString)), this, SLOT(setSearchFilter(QString)));
connect(m_filterLineEdit.data(), SIGNAL(filterChanged(QString)), this, SLOT(setSearchFilter(QString)));
m_stackedWidget = new QStackedWidget(this);
m_stackedWidget->addWidget(m_itemsView.data());
m_stackedWidget->addWidget(m_resourcesView.data());
connect(tabBar, SIGNAL(currentChanged(int)),
m_stackedWidget.data(), SLOT(setCurrentIndex(int)));
connect(tabBar, SIGNAL(currentChanged(int)),
this, SLOT(updateSearch()));
QWidget *spacer = new QWidget(this);
spacer->setObjectName(QLatin1String("itemLibrarySearchInputSpacer"));
......@@ -156,8 +154,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
/* style sheets */
setStyleSheet(QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css")));
m_resourcesView->setStyleSheet(
QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css")));
m_resourcesView->setStyleSheet(QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css")));
}
void ItemLibraryWidget::setItemLibraryInfo(ItemLibraryInfo *itemLibraryInfo)
......@@ -288,6 +285,11 @@ void ItemLibraryWidget::emitImportChecked()
emit meegoChecked(meegoImport);
}
void ItemLibraryWidget::setCurrentIndexOfStackedWidget(int index)
{
m_stackedWidget->setCurrentIndex(index);
}
void ItemLibraryWidget::setImportFilter(FilterChangeFlag flag)
{
return;
......@@ -346,7 +348,7 @@ void ItemLibraryWidget::updateModel()
void ItemLibraryWidget::updateSearch()
{
setSearchFilter(m_lineEdit->text());
setSearchFilter(m_filterLineEdit->text());
}
void ItemLibraryWidget::setResourcePath(const QString &resourcePath)
......
......@@ -87,7 +87,7 @@ public:
void setImportsWidget(QWidget *importsWidget);
public Q_SLOTS:
public slots:
void setSearchFilter(const QString &searchFilter);
void updateModel();
void updateSearch();
......@@ -117,6 +117,9 @@ signals:
void qtBasicOnlyChecked(bool b);
void meegoChecked(bool b);
private slots:
void setCurrentIndexOfStackedWidget(int index);
private:
ItemLibraryFileIconProvider m_iconProvider;
QSize m_itemIconSize;
......@@ -128,7 +131,7 @@ private:
QWeakPointer<QFileSystemModel> m_resourcesFileSystemModel;
QWeakPointer<QStackedWidget> m_stackedWidget;
QWeakPointer<Utils::FilterLineEdit> m_lineEdit;
QWeakPointer<Utils::FilterLineEdit> m_filterLineEdit;
QScopedPointer<QDeclarativeView> m_itemsView;
QScopedPointer<Internal::ItemLibraryTreeView> m_resourcesView;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment