Dont allow selection to overlap tab-widget border lines in preferences dialog.

This commit is contained in:
craig.p.drummond@gmail.com
2012-06-12 11:02:20 +00:00
parent 07721b9e48
commit 568ca4abf6
4 changed files with 15 additions and 12 deletions

View File

@@ -36,6 +36,8 @@
21. Enable mouse-tracking for all list/tree views.
22. Allow Icon/List for library view.
23. Add option to show artist images in library view.
24. Dont allow selection to overlap tab-widget border lines in preferences
dialog (Qt-only build).
0.7.1
-----

View File

@@ -76,9 +76,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, LyricsPage *lp)
#ifdef ENABLE_KDE_SUPPORT
KPageWidget *widget = new KPageWidget(this);
#else
FancyTabWidget *widget = new FancyTabWidget(this);
widget->setAllowContextMenu(false);
widget->setDrawBorder(true);
FancyTabWidget *widget = new FancyTabWidget(this, false, true);
#endif
server = new ServerSettings(widget);

View File

@@ -278,8 +278,9 @@ void FancyTab::setFader(float value)
tabbar->update();
}
FancyTabBar::FancyTabBar(QWidget *parent, bool text, int iSize)
FancyTabBar::FancyTabBar(QWidget *parent, bool hasBorder, bool text, int iSize)
: QWidget(parent)
, m_hasBorder(hasBorder)
, m_showText(text)
, m_iconSize(iSize)
{
@@ -440,6 +441,9 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
QRect rect = tabRect(tabIndex);
bool selected = (tabIndex == m_currentIndex);
if (m_hasBorder) {
rect.adjust(2, 0, -2, 0);
}
QStyleOptionViewItemV4 styleOpt;
styleOpt.initFrom(this);
styleOpt.state&=~(QStyle::State_Selected|QStyle::State_MouseOver);
@@ -527,7 +531,7 @@ void FancyTabBar::setCurrentIndex(int index) {
// FancyTabWidget
//////
FancyTabWidget::FancyTabWidget(QWidget* parent)
FancyTabWidget::FancyTabWidget(QWidget* parent, bool allowContext, bool drawBorder)
: QWidget(parent),
mode_(Mode_None),
tab_bar_(NULL),
@@ -538,8 +542,8 @@ FancyTabWidget::FancyTabWidget(QWidget* parent)
// use_background_(false),
menu_(NULL),
proxy_style_(new FancyTabProxyStyle),
allowContext_(true),
drawBorder_(false)
allowContext_(allowContext),
drawBorder_(drawBorder)
{
side_layout_->setSpacing(0);
side_layout_->setMargin(0);
@@ -718,7 +722,7 @@ void FancyTabWidget::SetMode(Mode mode) {
case Mode_IconOnlySmallSidebar:
case Mode_IconOnlyLargeSidebar:
case Mode_LargeSidebar: {
FancyTabBar* bar = new FancyTabBar(this, Mode_LargeSidebar==mode, Mode_IconOnlySmallSidebar==mode ? 16 : 32);
FancyTabBar* bar = new FancyTabBar(this, drawBorder_, Mode_LargeSidebar==mode, Mode_IconOnlySmallSidebar==mode ? 16 : 32);
side_layout_->insertWidget(0, bar);
tab_bar_ = bar;

View File

@@ -103,7 +103,7 @@ class FancyTabBar : public QWidget
Q_OBJECT
public:
FancyTabBar(QWidget *parent, bool text, int iSize );
FancyTabBar(QWidget *parent, bool hasBorder, bool text, int iSize );
~FancyTabBar();
void paintEvent(QPaintEvent *event);
@@ -148,6 +148,7 @@ private:
QList<FancyTab*> m_tabs;
QTimer m_triggerTimer;
QSize tabSizeHint() const;
bool m_hasBorder;
bool m_showText;
int m_iconSize;
};
@@ -156,7 +157,7 @@ class FancyTabWidget : public QWidget {
Q_OBJECT
public:
FancyTabWidget(QWidget* parent = 0);
FancyTabWidget(QWidget *parent, bool allowContext=true, bool drawBorder=false);
// Values are persisted - only add to the end
enum Mode {
@@ -208,8 +209,6 @@ public:
int count() const;
int visibleCount() const;
Mode mode() const { return mode_; }
void setAllowContextMenu(bool a) { allowContext_=a; }
void setDrawBorder(bool b) { drawBorder_=b; }
public slots:
void SetCurrentIndex(int index);