Commit 40318eb6 authored by Jörg Schummer's avatar Jörg Schummer
Browse files

QmlDesigner.ItemLibrary: corrected flickering of Items/Resources buttons

parent 72fb7628
......@@ -241,7 +241,6 @@ void ItemLibrary::setSearchFilter(const QString &searchFilter)
void ItemLibrary::itemLibraryButtonToggled()
{
m_d->m_ui.LibraryStackedWidget->setCurrentIndex(0);
m_d->m_ui.buttonItems->setChecked(true);
m_d->m_ui.buttonResources->setChecked(false);
setSearchFilter(m_d->m_ui.lineEdit->text());
}
......@@ -249,7 +248,6 @@ void ItemLibrary::itemLibraryButtonToggled()
void ItemLibrary::resourcesButtonToggled()
{
m_d->m_ui.LibraryStackedWidget->setCurrentIndex(1);
m_d->m_ui.buttonResources->setChecked(true);
m_d->m_ui.buttonItems->setChecked(false);
setSearchFilter(m_d->m_ui.lineEdit->text());
}
......
......@@ -6,8 +6,8 @@ VPATH += $$PWD
INCLUDEPATH += $$PWD
# Input
HEADERS += itemlibrary.h customdraganddrop.h itemlibrarymodel.h itemlibrarytreeview.h
HEADERS += itemlibrary.h customdraganddrop.h itemlibrarymodel.h itemlibrarywidgets.h
FORMS += itemlibrary.ui
SOURCES += itemlibrary.cpp customdraganddrop.cpp itemlibrarymodel.cpp itemlibrarytreeview.cpp
SOURCES += itemlibrary.cpp customdraganddrop.cpp itemlibrarymodel.cpp itemlibrarywidgets.cpp
RESOURCES += itemlibrary.qrc
......@@ -33,7 +33,7 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="buttonItems">
<widget class="QmlDesigner::Internal::ItemLibraryButton" name="buttonItems">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -71,7 +71,7 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="buttonResources">
<widget class="QmlDesigner::Internal::ItemLibraryButton" name="buttonResources">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -230,7 +230,12 @@
<customwidget>
<class>QmlDesigner::Internal::ItemLibraryTreeView</class>
<extends>QTreeView</extends>
<header>itemlibrarytreeview.h</header>
<header>itemlibrarywidgets.h</header>
</customwidget>
<customwidget>
<class>QmlDesigner::Internal::ItemLibraryButton</class>
<extends>QToolButton</extends>
<header>itemlibrarywidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -27,7 +27,7 @@
**
**************************************************************************/
#include "itemlibrarytreeview.h"
#include "itemlibrarywidgets.h"
#include "itemlibrary.h"
#include "customdraganddrop.h"
......@@ -103,6 +103,17 @@ void ItemLibraryTreeView::activateItem( const QModelIndex & /*index*/)
}
}
ItemLibraryButton::ItemLibraryButton(QWidget *parent)
: QToolButton(parent)
{
}
void ItemLibraryButton::mousePressEvent(QMouseEvent *event)
{
if (!isChecked())
QToolButton::mousePressEvent(event);
}
} // namespace Internal
} // namespace QmlDesigner
......
......@@ -35,6 +35,7 @@
#include <QDrag>
#include <QDebug>
#include <QTimeLine>
#include <QToolButton>
QT_FORWARD_DECLARE_CLASS(QLabel);
......@@ -57,6 +58,13 @@ private slots:
void activateItem( const QModelIndex &index);
};
class ItemLibraryButton : public QToolButton {
public:
ItemLibraryButton(QWidget *parent = 0);
protected:
void mousePressEvent(QMouseEvent *event);
};
} // namespace Internal
......
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