+ use icon of style sheet for task header
+ fix size issue with task panel + enable QSint task panel
This commit is contained in:
parent
df04df01f7
commit
5b3d50afc4
|
@ -85,6 +85,8 @@
|
|||
#include "View3DPy.h"
|
||||
#include "DlgOnlineHelpImp.h"
|
||||
#include "SpaceballEvent.h"
|
||||
#include "Control.h"
|
||||
#include "TaskView/TaskView.h"
|
||||
|
||||
#include "SplitView3DInventor.h"
|
||||
#include "View3DInventor.h"
|
||||
|
@ -1792,6 +1794,10 @@ void Application::runApplication(void)
|
|||
mdi->setBackground(QBrush(Qt::NoBrush));
|
||||
QTextStream str(&f);
|
||||
qApp->setStyleSheet(str.readAll());
|
||||
|
||||
Gui::TaskView::TaskView* taskPanel = Control().taskPanel();
|
||||
if (taskPanel)
|
||||
taskPanel->clearActionStyle();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace QSint
|
|||
{
|
||||
|
||||
|
||||
const char* ActionPaneFreeCAD =
|
||||
const char* ActionPanelFreeCAD =
|
||||
|
||||
"QFrame[class='panel'] {"
|
||||
"background-color:qlineargradient(x1:1, y1:0.3, x2:1, y2:0, stop:0 rgb(51,51,101), stop:1 rgb(171,171,193));"
|
||||
|
@ -98,7 +98,7 @@ FreeCADPanelScheme::FreeCADPanelScheme() : ActionPanelScheme()
|
|||
#if defined(Q_OS_WIN32)
|
||||
ActionPanelScheme* panelStyle = WinXPPanelScheme2::defaultScheme();
|
||||
|
||||
actionStyle = QString(ActionPaneFreeCAD);
|
||||
actionStyle = QString(ActionPanelFreeCAD);
|
||||
#elif defined(Q_OS_MAC)
|
||||
ActionPanelScheme* panelStyle = MacPanelScheme::defaultScheme();
|
||||
|
||||
|
@ -123,19 +123,46 @@ FreeCADPanelScheme::FreeCADPanelScheme() : ActionPanelScheme()
|
|||
groupFoldDelay = panelStyle->groupFoldDelay;
|
||||
groupFoldEffect = panelStyle->groupFoldEffect;
|
||||
groupFoldThaw = panelStyle->groupFoldThaw;
|
||||
|
||||
|
||||
builtinFold = headerButtonFold;
|
||||
builtinFoldOver = headerButtonFoldOver;
|
||||
builtinUnfold = headerButtonUnfold;
|
||||
builtinUnfoldOver = headerButtonUnfoldOver;
|
||||
}
|
||||
|
||||
void FreeCADPanelScheme::clearActionStyle()
|
||||
{
|
||||
headerButtonFold = QPixmap();
|
||||
headerButtonFoldOver = QPixmap();
|
||||
headerButtonUnfold = QPixmap();
|
||||
headerButtonUnfoldOver = QPixmap();
|
||||
|
||||
actionStyle.clear();
|
||||
}
|
||||
|
||||
void FreeCADPanelScheme::restoreActionStyle()
|
||||
{
|
||||
headerButtonFold = builtinFold;
|
||||
headerButtonFoldOver = builtinFoldOver;
|
||||
headerButtonUnfold = builtinUnfold;
|
||||
headerButtonUnfoldOver = builtinUnfoldOver;
|
||||
|
||||
actionStyle = builtinScheme;
|
||||
}
|
||||
|
||||
QPixmap FreeCADPanelScheme::drawFoldIcon(const QPalette& p) const
|
||||
/*!
|
||||
\code
|
||||
QPalette p = QApplication::palette();
|
||||
QPalette p2 = p;
|
||||
p2.setColor(QPalette::Highlight,p2.color(QPalette::Highlight).lighter());
|
||||
headerButtonFold = drawFoldIcon(p, true);
|
||||
headerButtonFoldOver = drawFoldIcon(p2, true);
|
||||
headerButtonUnfold = drawFoldIcon(p, false);
|
||||
headerButtonUnfoldOver = drawFoldIcon(p2, false);
|
||||
\endcode
|
||||
*/
|
||||
QPixmap FreeCADPanelScheme::drawFoldIcon(const QPalette& p, bool fold) const
|
||||
{
|
||||
QImage img(17,17,QImage::Format_ARGB32_Premultiplied);
|
||||
img.fill(0x00000000);
|
||||
|
@ -155,48 +182,13 @@ QPixmap FreeCADPanelScheme::drawFoldIcon(const QPalette& p) const
|
|||
painter.drawLine(QLine(8,8,11,11));
|
||||
painter.drawLine(QLine(9,8,10,11));
|
||||
painter.end();
|
||||
|
||||
if (!fold) {
|
||||
QTransform mat;
|
||||
mat.rotate(180.0);
|
||||
img = img.transformed(mat);
|
||||
}
|
||||
return QPixmap::fromImage(img);
|
||||
}
|
||||
|
||||
}
|
||||
#if 0
|
||||
iisFreeCADTaskPanelScheme::iisFreeCADTaskPanelScheme(QObject *parent)
|
||||
: iisTaskPanelScheme(parent)
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
#else
|
||||
QPalette p = QApplication::palette();
|
||||
QLinearGradient panelBackgroundGrd(0,0, 0,300);
|
||||
panelBackgroundGrd.setColorAt(1, p.color(QPalette::Dark));
|
||||
panelBackgroundGrd.setColorAt(0, p.color(QPalette::Midlight));
|
||||
panelBackground = panelBackgroundGrd;
|
||||
|
||||
QLinearGradient headerBackgroundGrd(0,0,0,100);
|
||||
headerBackgroundGrd.setColorAt(0, p.color(QPalette::Highlight));
|
||||
headerBackgroundGrd.setColorAt(1, p.color(QPalette::Highlight).lighter());
|
||||
headerBackground = headerBackgroundGrd;
|
||||
|
||||
headerLabelScheme.text = p.color(QPalette::HighlightedText);
|
||||
headerLabelScheme.textOver = p.color(QPalette::BrightText);
|
||||
headerLabelScheme.iconSize = 22;
|
||||
|
||||
headerButtonSize = QSize(17,17);
|
||||
QPalette p2 = p;
|
||||
p2.setColor(QPalette::Highlight,p2.color(QPalette::Highlight).lighter());
|
||||
QPixmap px1 = drawFoldIcon(p);
|
||||
QPixmap px2 = drawFoldIcon(p2);
|
||||
headerButtonFold = px1;
|
||||
headerButtonFoldOver = px2;
|
||||
QTransform mat;
|
||||
mat.rotate(180.0);
|
||||
headerButtonUnfold = px1.transformed(mat);
|
||||
headerButtonUnfoldOver = px2.transformed(mat);
|
||||
|
||||
groupBackground = p.window();
|
||||
groupBorder = p.color(QPalette::Window);
|
||||
|
||||
taskLabelScheme.text = p.color(QPalette::Text);
|
||||
taskLabelScheme.textOver = p.color(QPalette::Highlight);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -46,8 +46,12 @@ public:
|
|||
void restoreActionStyle();
|
||||
|
||||
private:
|
||||
QPixmap drawFoldIcon(const QPalette& p) const;
|
||||
QPixmap drawFoldIcon(const QPalette& p, bool fold) const;
|
||||
QString builtinScheme;
|
||||
QPixmap builtinFold;
|
||||
QPixmap builtinFoldOver;
|
||||
QPixmap builtinUnfold;
|
||||
QPixmap builtinUnfoldOver;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#ifndef _PreComp_
|
||||
# include <boost/bind.hpp>
|
||||
# include <QActionEvent>
|
||||
# include <QApplication>
|
||||
# include <QCursor>
|
||||
# include <QPushButton>
|
||||
#endif
|
||||
|
@ -321,7 +322,7 @@ TaskView::TaskView(QWidget *parent)
|
|||
taskPanel->setScheme(iisFreeCADTaskPanelScheme::defaultScheme());
|
||||
#else
|
||||
taskPanel = new QSint::ActionPanel(this);
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(taskPanel->sizePolicy().hasHeightForWidth());
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef GUI_TASKVIEW_TASKVIEW_H
|
||||
#define GUI_TASKVIEW_TASKVIEW_H
|
||||
|
||||
//#define QSINT_ACTIONPANEL
|
||||
#define QSINT_ACTIONPANEL
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
|
Loading…
Reference in New Issue
Block a user