Commit fef49e17 authored by Ramon Buldó's avatar Ramon Buldó
Browse files

Use QWidget instead of ToolBarStyleWidget, it messes up some themes.

parent 92d49342
......@@ -35,7 +35,7 @@
<number>0</number>
</property>
<item>
<widget class="ToolBarStyleWidget" name="widgetHeader" native="true">
<widget class="QWidget" name="widgetHeader" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
......@@ -165,7 +165,7 @@
</widget>
</item>
<item>
<widget class="ToolBarStyleWidget" name="widgetBottom" native="true">
<widget class="QWidget" name="widgetBottom" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="buttonAllSettings">
......@@ -267,12 +267,6 @@
<extends>QListWidget</extends>
<header>widgets/ListWidget.h</header>
</customwidget>
<customwidget>
<class>ToolBarStyleWidget</class>
<extends>QWidget</extends>
<header>widgets/ToolBarStyleWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="resources.qrc"/>
......
......@@ -46,8 +46,7 @@ SOURCES += main.cpp \
widgets/LocaleGlobal.cpp \
widgets/keyboardpreview.cpp \
widgets/PageWidget.cpp \
widgets/TimeZoneWidget.cpp \
widgets/ToolBarStyleWidget.cpp
widgets/TimeZoneWidget.cpp
......@@ -88,8 +87,7 @@ HEADERS += mainwindow.h \
widgets/LocaleGlobal.h \
widgets/keyboardpreview.h \
widgets/PageWidget.h \
widgets/TimeZoneWidget.h \
widgets/ToolBarStyleWidget.h
widgets/TimeZoneWidget.h
......
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ToolBarStyleWidget.h"
ToolBarStyleWidget::ToolBarStyleWidget(QWidget *parent) :
QWidget(parent)
{
}
void ToolBarStyleWidget::paintEvent(QPaintEvent *) {
QPainter p(this);
QRegion emptyArea(rect());
//draw border
if(int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this)) {
QRegion borderReg;
borderReg += QRect(0, 0, fw, height()); //left
borderReg += QRect(width()-fw, 0, fw, height()); //right
borderReg += QRect(0, 0, width(), fw); //top
borderReg += QRect(0, height()-fw, width(), fw); //bottom
p.setClipRegion(borderReg);
emptyArea -= borderReg;
QStyleOptionFrame frame;
frame.rect = rect();
frame.palette = palette();
frame.state = QStyle::State_None;
frame.lineWidth = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth);
frame.midLineWidth = 0;
style()->drawPrimitive(QStyle::PE_PanelMenuBar, &frame, &p, this);
}
p.setClipRegion(emptyArea);
QStyleOptionMenuItem menuOpt;
menuOpt.palette = palette();
menuOpt.state = QStyle::State_None;
menuOpt.menuItemType = QStyleOptionMenuItem::EmptyArea;
menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;
menuOpt.rect = rect();
menuOpt.menuRect = rect();
style()->drawControl(QStyle::CE_MenuBarEmptyArea, &menuOpt, &p, this);
}
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TOOLBARSTYLEWIDGET_H
#define TOOLBARSTYLEWIDGET_H
#include <QWidget>
#include <QPainter>
#include <QStyle>
#include <QStyleOption>
#include <QRegion>
#include <QPalette>
class ToolBarStyleWidget : public QWidget
{
Q_OBJECT
public:
explicit ToolBarStyleWidget(QWidget *parent = 0);
protected:
void paintEvent(QPaintEvent *);
};
#endif // TOOLBARSTYLEWIDGET_H
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