forked from qt-creator/qt-creator
Tweak frame for open editors and open help pages switchers
In the GTK style the scroll bar likes to be outside of the scroll area frame. Like with the completion widget, we put the visible frame explicitly outside of the scroll bar. Reviewed-by: Jens Bache-Wiig
This commit is contained in:
@@ -35,9 +35,10 @@
|
|||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtGui/QFocusEvent>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
#include <QtGui/QTreeWidget>
|
#include <QtGui/QTreeWidget>
|
||||||
#include <QtGui/QFocusEvent>
|
#include <QtGui/QVBoxLayout>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Core::Internal::EditorView*)
|
Q_DECLARE_METATYPE(Core::Internal::EditorView*)
|
||||||
Q_DECLARE_METATYPE(Core::IFile *)
|
Q_DECLARE_METATYPE(Core::IFile *)
|
||||||
@@ -49,7 +50,7 @@ const int WIDTH = 300;
|
|||||||
const int HEIGHT = 200;
|
const int HEIGHT = 200;
|
||||||
|
|
||||||
OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) :
|
OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) :
|
||||||
QWidget(parent, Qt::Popup),
|
QFrame(parent, Qt::Popup),
|
||||||
m_emptyIcon(QLatin1String(":/core/images/empty14.png")),
|
m_emptyIcon(QLatin1String(":/core/images/empty14.png")),
|
||||||
m_editorList(new QTreeWidget(this))
|
m_editorList(new QTreeWidget(this))
|
||||||
{
|
{
|
||||||
@@ -63,7 +64,17 @@ OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) :
|
|||||||
m_editorList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
m_editorList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
#endif
|
#endif
|
||||||
m_editorList->installEventFilter(this);
|
m_editorList->installEventFilter(this);
|
||||||
m_editorList->setGeometry(0, 0, WIDTH, HEIGHT);
|
|
||||||
|
// We disable the frame on this list view and use a QFrame around it instead.
|
||||||
|
// This improves the look with QGTKStyle.
|
||||||
|
#ifndef Q_WS_MAC
|
||||||
|
setFrameStyle(m_editorList->frameStyle());
|
||||||
|
#endif
|
||||||
|
m_editorList->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
|
layout->setMargin(0);
|
||||||
|
layout->addWidget(m_editorList);
|
||||||
|
|
||||||
connect(m_editorList, SIGNAL(itemClicked(QTreeWidgetItem*, int)),
|
connect(m_editorList, SIGNAL(itemClicked(QTreeWidgetItem*, int)),
|
||||||
this, SLOT(editorClicked(QTreeWidgetItem*)));
|
this, SLOT(editorClicked(QTreeWidgetItem*)));
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#ifndef OPENEDITORSWINDOW_H
|
#ifndef OPENEDITORSWINDOW_H
|
||||||
#define OPENEDITORSWINDOW_H
|
#define OPENEDITORSWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QFrame>
|
||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -48,7 +48,7 @@ namespace Internal {
|
|||||||
class EditorHistoryItem;
|
class EditorHistoryItem;
|
||||||
class EditorView;
|
class EditorView;
|
||||||
|
|
||||||
class OpenEditorsWindow : public QWidget
|
class OpenEditorsWindow : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <QtCore/QEvent>
|
#include <QtCore/QEvent>
|
||||||
|
|
||||||
#include <QtGui/QKeyEvent>
|
#include <QtGui/QKeyEvent>
|
||||||
|
#include <QtGui/QVBoxLayout>
|
||||||
|
|
||||||
using namespace Help::Internal;
|
using namespace Help::Internal;
|
||||||
|
|
||||||
@@ -43,16 +44,26 @@ const int gWidth = 300;
|
|||||||
const int gHeight = 200;
|
const int gHeight = 200;
|
||||||
|
|
||||||
OpenPagesSwitcher::OpenPagesSwitcher(OpenPagesModel *model)
|
OpenPagesSwitcher::OpenPagesSwitcher(OpenPagesModel *model)
|
||||||
: QWidget(0, Qt::Popup)
|
: QFrame(0, Qt::Popup)
|
||||||
, m_openPagesModel(model)
|
, m_openPagesModel(model)
|
||||||
{
|
{
|
||||||
resize(gWidth, gHeight);
|
resize(gWidth, gHeight);
|
||||||
|
|
||||||
m_openPagesWidget = new OpenPagesWidget(m_openPagesModel, this);
|
m_openPagesWidget = new OpenPagesWidget(m_openPagesModel, this);
|
||||||
|
|
||||||
|
// We disable the frame on this list view and use a QFrame around it instead.
|
||||||
|
// This improves the look with QGTKStyle.
|
||||||
|
#ifndef Q_WS_MAC
|
||||||
|
setFrameStyle(m_openPagesWidget->frameStyle());
|
||||||
|
#endif
|
||||||
|
m_openPagesWidget->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
m_openPagesWidget->allowContextMenu(false);
|
m_openPagesWidget->allowContextMenu(false);
|
||||||
m_openPagesWidget->installEventFilter(this);
|
m_openPagesWidget->installEventFilter(this);
|
||||||
m_openPagesWidget->setGeometry(0, 0, gWidth, gHeight);
|
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
|
layout->setMargin(0);
|
||||||
|
layout->addWidget(m_openPagesWidget);
|
||||||
|
|
||||||
connect(m_openPagesWidget, SIGNAL(closePage(QModelIndex)), this,
|
connect(m_openPagesWidget, SIGNAL(closePage(QModelIndex)), this,
|
||||||
SIGNAL(closePage(QModelIndex)));
|
SIGNAL(closePage(QModelIndex)));
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
#ifndef OPENPAGESSWITCHER_H
|
#ifndef OPENPAGESSWITCHER_H
|
||||||
#define OPENPAGESSWITCHER_H
|
#define OPENPAGESSWITCHER_H
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QFrame>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QModelIndex)
|
QT_FORWARD_DECLARE_CLASS(QModelIndex)
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ namespace Help {
|
|||||||
class OpenPagesModel;
|
class OpenPagesModel;
|
||||||
class OpenPagesWidget;
|
class OpenPagesWidget;
|
||||||
|
|
||||||
class OpenPagesSwitcher : public QWidget
|
class OpenPagesSwitcher : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user