+ usage of QSint
This commit is contained in:
@@ -22,6 +22,9 @@
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QSplitter>
|
||||
#endif
|
||||
|
||||
/// Here the FreeCAD includes sorted by Base,App,Gui......
|
||||
|
||||
@@ -75,11 +78,11 @@ CombiView::CombiView(Gui::Document* pcDocument, QWidget *parent)
|
||||
|
||||
// task panel
|
||||
taskPanel = new Gui::TaskView::TaskView(this);
|
||||
tabs->addTab(taskPanel, trUtf8("Tasks"));
|
||||
|
||||
tabs->addTab(taskPanel, trUtf8("Tasks"));
|
||||
|
||||
// task panel
|
||||
//projectView = new Gui::ProjectWidget(this);
|
||||
//tabs->addTab(projectView, trUtf8("Project"));
|
||||
//tabs->addTab(projectView, trUtf8("Project"));
|
||||
}
|
||||
|
||||
CombiView::~CombiView()
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QAction>
|
||||
# include <QApplication>
|
||||
# include <QDebug>
|
||||
# include <QDockWidget>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <sstream>
|
||||
# include <QFile>
|
||||
# include <QPointer>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <boost/bind.hpp>
|
||||
# include <QActionEvent>
|
||||
# include <QCursor>
|
||||
# include <QPushButton>
|
||||
#endif
|
||||
|
||||
#include "TaskView.h"
|
||||
@@ -37,6 +39,12 @@
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/Control.h>
|
||||
|
||||
#if defined (QSINT_ACTIONPANEL)
|
||||
#include <Gui/QSint/actionpanel/taskgroup_p.h>
|
||||
#include <Gui/QSint/actionpanel/taskheader_p.h>
|
||||
#include <Gui/QSint/actionpanel/freecadscheme.h>
|
||||
#endif
|
||||
|
||||
using namespace Gui::TaskView;
|
||||
|
||||
//**************************************************************************
|
||||
@@ -67,6 +75,7 @@ TaskWidget::~TaskWidget()
|
||||
// TaskGroup
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
TaskGroup::TaskGroup(QWidget *parent)
|
||||
: iisTaskGroup(parent, false)
|
||||
{
|
||||
@@ -128,17 +137,76 @@ void TaskGroup::actionEvent (QActionEvent* e)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
TaskGroup::TaskGroup(QWidget *parent)
|
||||
: QSint::ActionBox(parent)
|
||||
{
|
||||
}
|
||||
|
||||
TaskGroup::TaskGroup(const QString & headerText, QWidget *parent)
|
||||
: QSint::ActionBox(headerText, parent)
|
||||
{
|
||||
}
|
||||
|
||||
TaskGroup::TaskGroup(const QPixmap & icon, const QString & headerText, QWidget *parent)
|
||||
: QSint::ActionBox(icon, headerText, parent)
|
||||
{
|
||||
}
|
||||
|
||||
TaskGroup::~TaskGroup()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskGroup::actionEvent (QActionEvent* e)
|
||||
{
|
||||
QAction *action = e->action();
|
||||
switch (e->type()) {
|
||||
case QEvent::ActionAdded:
|
||||
{
|
||||
QSint::ActionLabel *label = this->createItem(action);
|
||||
break;
|
||||
}
|
||||
case QEvent::ActionChanged:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case QEvent::ActionRemoved:
|
||||
{
|
||||
// cannot change anything
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//**************************************************************************
|
||||
//**************************************************************************
|
||||
// TaskBox
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
TaskBox::TaskBox(const QPixmap &icon, const QString &title, bool expandable, QWidget *parent)
|
||||
: iisTaskBox(icon, title, expandable, parent), wasShown(false)
|
||||
{
|
||||
setScheme(iisFreeCADTaskPanelScheme::defaultScheme());
|
||||
}
|
||||
#else
|
||||
TaskBox::TaskBox(QWidget *parent)
|
||||
: QSint::ActionGroup(parent), wasShown(false)
|
||||
{
|
||||
}
|
||||
|
||||
TaskBox::TaskBox(const QString &title, bool expandable, QWidget *parent)
|
||||
: QSint::ActionGroup(title, expandable, parent), wasShown(false)
|
||||
{
|
||||
}
|
||||
|
||||
TaskBox::TaskBox(const QPixmap &icon, const QString &title, bool expandable, QWidget *parent)
|
||||
: QSint::ActionGroup(icon, title, expandable, parent), wasShown(false)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
TaskBox::~TaskBox()
|
||||
{
|
||||
@@ -202,14 +270,20 @@ void TaskBox::actionEvent (QActionEvent* e)
|
||||
switch (e->type()) {
|
||||
case QEvent::ActionAdded:
|
||||
{
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
TaskIconLabel *label = new TaskIconLabel(
|
||||
action->icon(), action->text(), this);
|
||||
this->addIconLabel(label);
|
||||
connect(label,SIGNAL(clicked()),action,SIGNAL(triggered()));
|
||||
#else
|
||||
QSint::ActionLabel *label = new QSint::ActionLabel(action, this);
|
||||
this->addActionLabel(label, true, false);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case QEvent::ActionChanged:
|
||||
{
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
// update label when action changes
|
||||
QBoxLayout* bl = myGroup->groupLayout();
|
||||
int index = this->actions().indexOf(action);
|
||||
@@ -217,6 +291,7 @@ void TaskBox::actionEvent (QActionEvent* e)
|
||||
QWidgetItem* item = static_cast<QWidgetItem*>(bl->itemAt(index));
|
||||
TaskIconLabel* label = static_cast<TaskIconLabel*>(item->widget());
|
||||
label->setTitle(action->text());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case QEvent::ActionRemoved:
|
||||
@@ -241,8 +316,18 @@ TaskView::TaskView(QWidget *parent)
|
||||
//addWidget(new TaskEditControl(this));
|
||||
//addWidget(new TaskAppearance(this));
|
||||
//addStretch();
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
taskPanel = new iisTaskPanel(this);
|
||||
taskPanel->setScheme(iisFreeCADTaskPanelScheme::defaultScheme());
|
||||
#else
|
||||
taskPanel = new QSint::ActionPanel(this);
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(taskPanel->sizePolicy().hasHeightForWidth());
|
||||
taskPanel->setSizePolicy(sizePolicy);
|
||||
taskPanel->setScheme(QSint::FreeCADPanelScheme::defaultScheme());
|
||||
#endif
|
||||
this->setWidget(taskPanel);
|
||||
setWidgetResizable(true);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
@@ -408,6 +493,10 @@ void TaskView::showDialog(TaskDialog *dlg)
|
||||
taskPanel->addWidget(ActiveCtrl);
|
||||
}
|
||||
|
||||
#if defined (QSINT_ACTIONPANEL)
|
||||
taskPanel->setScheme(QSint::FreeCADPanelScheme::defaultScheme());
|
||||
#endif
|
||||
|
||||
if (!dlg->needsFullSpace())
|
||||
taskPanel->addStretch();
|
||||
|
||||
@@ -487,6 +576,10 @@ void TaskView::addTaskWatcher(void)
|
||||
if (!ActiveWatcher.empty())
|
||||
taskPanel->addStretch();
|
||||
updateWatcher();
|
||||
|
||||
#if defined (QSINT_ACTIONPANEL)
|
||||
taskPanel->setScheme(QSint::FreeCADPanelScheme::defaultScheme());
|
||||
#endif
|
||||
}
|
||||
|
||||
void TaskView::removeTaskWatcher(void)
|
||||
|
||||
@@ -24,12 +24,19 @@
|
||||
#ifndef GUI_TASKVIEW_TASKVIEW_H
|
||||
#define GUI_TASKVIEW_TASKVIEW_H
|
||||
|
||||
//#define QSINT_ACTIONPANEL
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/signals.hpp>
|
||||
#include <QScrollArea>
|
||||
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
#include <Gui/iisTaskPanel/include/iisTaskPanel>
|
||||
#else
|
||||
#include <Gui/QSint/include/QSint>
|
||||
#endif
|
||||
#include <Gui/Selection.h>
|
||||
#include "TaskWatcher.h"
|
||||
|
||||
@@ -57,6 +64,7 @@ public:
|
||||
//~TaskContent();
|
||||
};
|
||||
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
class GuiExport TaskGroup : public iisTaskGroup, public TaskContent
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -68,14 +76,58 @@ public:
|
||||
protected:
|
||||
void actionEvent (QActionEvent*);
|
||||
};
|
||||
|
||||
/// Father class of content with header and Icon
|
||||
class GuiExport TaskBox : public iisTaskBox, public TaskContent
|
||||
#else
|
||||
class GuiExport TaskGroup : public QSint::ActionBox, public TaskContent
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TaskGroup(QWidget *parent = 0);
|
||||
explicit TaskGroup(const QString & headerText, QWidget *parent = 0);
|
||||
explicit TaskGroup(const QPixmap & icon, const QString & headerText, QWidget *parent = 0);
|
||||
~TaskGroup();
|
||||
|
||||
protected:
|
||||
void actionEvent (QActionEvent*);
|
||||
};
|
||||
#endif
|
||||
|
||||
/// Father class of content with header and Icon
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
class GuiExport TaskBox : public iisTaskBox, public TaskContent
|
||||
#else
|
||||
class GuiExport TaskBox : public QSint::ActionGroup, public TaskContent
|
||||
#endif
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
TaskBox(const QPixmap &icon, const QString &title, bool expandable, QWidget *parent);
|
||||
#else
|
||||
/** Constructor. Creates TaskBox without header.
|
||||
*/
|
||||
explicit TaskBox(QWidget *parent = 0);
|
||||
|
||||
/** Constructor. Creates TaskBox with header's
|
||||
text set to \a title, but with no icon.
|
||||
|
||||
If \a expandable set to \a true (default), the group can be expanded/collapsed by the user.
|
||||
*/
|
||||
explicit TaskBox(const QString& title,
|
||||
bool expandable = true,
|
||||
QWidget *parent = 0);
|
||||
|
||||
/** Constructor. Creates TaskBox with header's
|
||||
text set to \a title and icon set to \a icon.
|
||||
|
||||
If \a expandable set to \a true (default), the group can be expanded/collapsed by the user.
|
||||
*/
|
||||
explicit TaskBox(const QPixmap& icon,
|
||||
const QString& title,
|
||||
bool expandable = true,
|
||||
QWidget *parent = 0);
|
||||
#endif
|
||||
~TaskBox();
|
||||
void hideGroupBox();
|
||||
bool isGroupVisible() const;
|
||||
@@ -145,7 +197,11 @@ protected:
|
||||
|
||||
std::vector<TaskWatcher*> ActiveWatcher;
|
||||
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
iisTaskPanel* taskPanel;
|
||||
#else
|
||||
QSint::ActionPanel* taskPanel;
|
||||
#endif
|
||||
TaskDialog *ActiveDialog;
|
||||
TaskEditControl *ActiveCtrl;
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QDockWidget>
|
||||
# include <QStatusBar>
|
||||
#endif
|
||||
|
||||
#include "Workbench.h"
|
||||
#include "WorkbenchPy.h"
|
||||
|
||||
@@ -149,7 +149,11 @@ TaskSmoothing::TaskSmoothing()
|
||||
|
||||
selection = new Selection();
|
||||
selection->setObjects(Gui::Selection().getSelectionEx(0, Mesh::Feature::getClassTypeId()));
|
||||
#if !defined (QSINT_ACTIONPANEL)
|
||||
Gui::TaskView::TaskGroup* tasksel = new Gui::TaskView::TaskGroup();
|
||||
#else
|
||||
Gui::TaskView::TaskBox* tasksel = new Gui::TaskView::TaskBox();
|
||||
#endif
|
||||
tasksel->groupLayout()->addWidget(selection);
|
||||
tasksel->hide();
|
||||
Content.push_back(tasksel);
|
||||
|
||||
Reference in New Issue
Block a user