2010-07-06 11:05:43 +02:00
|
|
|
#include "contextpanewidget.h"
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
#include <QFontComboBox>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QSpinBox>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QVBoxLayout>
|
2010-07-06 14:36:02 +02:00
|
|
|
#include <QLabel>
|
2010-07-06 11:05:43 +02:00
|
|
|
#include <QMouseEvent>
|
|
|
|
|
#include <QGridLayout>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QAction>
|
|
|
|
|
#include <qmldesignerplugin.h>
|
|
|
|
|
#include "colorwidget.h"
|
|
|
|
|
#include "contextpanetextwidget.h"
|
2010-07-19 12:06:40 +02:00
|
|
|
#include "easingcontextpane.h"
|
2010-07-15 16:44:53 +02:00
|
|
|
#include "contextpanewidgetimage.h"
|
|
|
|
|
#include "contextpanewidgetrectangle.h"
|
2010-07-06 11:05:43 +02:00
|
|
|
|
|
|
|
|
namespace QmlDesigner {
|
|
|
|
|
|
2010-08-02 17:10:16 +02:00
|
|
|
/* XPM */
|
|
|
|
|
static const char * const line_xpm[] = {
|
|
|
|
|
"12 12 2 1",
|
|
|
|
|
" c None",
|
2010-08-03 12:48:00 +02:00
|
|
|
". c #0c0c0c",
|
|
|
|
|
"............",
|
|
|
|
|
". .",
|
|
|
|
|
". .",
|
|
|
|
|
". .",
|
|
|
|
|
". .",
|
|
|
|
|
". .",
|
|
|
|
|
". .",
|
|
|
|
|
". .",
|
|
|
|
|
". .",
|
|
|
|
|
". ........ .",
|
|
|
|
|
". .",
|
|
|
|
|
"............"};
|
2010-08-02 17:10:16 +02:00
|
|
|
|
2010-08-03 12:48:00 +02:00
|
|
|
/* XPM */
|
2010-08-04 16:56:06 +10:00
|
|
|
static const char * pin_xpm[] = {
|
2010-08-03 12:48:00 +02:00
|
|
|
"12 9 7 1",
|
|
|
|
|
" c None",
|
|
|
|
|
". c #000000",
|
|
|
|
|
"+ c #515151",
|
|
|
|
|
"@ c #A8A8A8",
|
|
|
|
|
"# c #A9A9A9",
|
|
|
|
|
"$ c #999999",
|
|
|
|
|
"% c #696969",
|
|
|
|
|
" . ",
|
|
|
|
|
" ......+",
|
|
|
|
|
" .@@@@@.",
|
|
|
|
|
" .#####.",
|
|
|
|
|
"+.....$$$$$.",
|
|
|
|
|
" .%%%%%.",
|
|
|
|
|
" .......",
|
|
|
|
|
" ......+",
|
|
|
|
|
" . "};
|
2010-07-26 13:47:59 +02:00
|
|
|
|
|
|
|
|
DragWidget::DragWidget(QWidget *parent) : QFrame(parent)
|
2010-07-06 11:05:43 +02:00
|
|
|
{
|
|
|
|
|
setFrameStyle(QFrame::NoFrame);
|
|
|
|
|
setFrameShape(QFrame::StyledPanel);
|
|
|
|
|
setFrameShadow(QFrame::Sunken);
|
|
|
|
|
m_oldPos = QPoint(-1, -1);
|
2010-07-22 13:35:38 +02:00
|
|
|
m_pos = QPoint(-1, -1);
|
2010-07-06 11:05:43 +02:00
|
|
|
|
|
|
|
|
m_dropShadowEffect = new QGraphicsDropShadowEffect;
|
|
|
|
|
m_dropShadowEffect->setBlurRadius(6);
|
|
|
|
|
m_dropShadowEffect->setOffset(2, 2);
|
|
|
|
|
setGraphicsEffect(m_dropShadowEffect);
|
2010-07-26 13:47:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DragWidget::mousePressEvent(QMouseEvent * event)
|
|
|
|
|
{
|
|
|
|
|
if (event->button() == Qt::LeftButton) {
|
|
|
|
|
m_oldPos = event->globalPos();
|
|
|
|
|
m_opacityEffect = new QGraphicsOpacityEffect;
|
|
|
|
|
setGraphicsEffect(m_opacityEffect);
|
|
|
|
|
event->accept();
|
|
|
|
|
}
|
|
|
|
|
QFrame::mousePressEvent(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DragWidget::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->button() == Qt::LeftButton) {
|
|
|
|
|
m_oldPos = QPoint(-1, -1);
|
|
|
|
|
m_dropShadowEffect = new QGraphicsDropShadowEffect;
|
|
|
|
|
m_dropShadowEffect->setBlurRadius(6);
|
|
|
|
|
m_dropShadowEffect->setOffset(2, 2);
|
|
|
|
|
setGraphicsEffect(m_dropShadowEffect);
|
|
|
|
|
}
|
|
|
|
|
QFrame::mouseReleaseEvent(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DragWidget::mouseMoveEvent(QMouseEvent * event)
|
|
|
|
|
{
|
|
|
|
|
if (event->buttons() && Qt::LeftButton) {
|
|
|
|
|
if (pos().x() < 10 && event->pos().x() < -20)
|
|
|
|
|
return;
|
|
|
|
|
if (m_oldPos != QPoint(-1, -1)) {
|
|
|
|
|
QPoint diff = event->globalPos() - m_oldPos;
|
|
|
|
|
QPoint newPos = pos() + diff;
|
|
|
|
|
if (newPos.x() > 0 && newPos.y() > 0 && (newPos.x() + width()) < parentWidget()->width() && (newPos.y() + height()) < parentWidget()->height()) {
|
|
|
|
|
if (m_secondaryTarget)
|
|
|
|
|
m_secondaryTarget->move(m_secondaryTarget->pos() + diff);
|
|
|
|
|
move(newPos);
|
|
|
|
|
m_pos = newPos;
|
2010-08-03 12:48:00 +02:00
|
|
|
protectedMoved();
|
2010-07-26 13:47:59 +02:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
m_opacityEffect = new QGraphicsOpacityEffect;
|
|
|
|
|
setGraphicsEffect(m_opacityEffect);
|
|
|
|
|
}
|
|
|
|
|
m_oldPos = event->globalPos();
|
|
|
|
|
event->accept();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-03 12:48:00 +02:00
|
|
|
void DragWidget::protectedMoved()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-26 13:47:59 +02:00
|
|
|
ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_currentWidget(0)
|
|
|
|
|
{
|
2010-07-06 11:05:43 +02:00
|
|
|
QGridLayout *layout = new QGridLayout(this);
|
2010-07-20 10:22:40 +02:00
|
|
|
layout->setMargin(0);
|
|
|
|
|
layout->setContentsMargins(1, 1, 1, 1);
|
|
|
|
|
layout->setSpacing(0);
|
2010-08-03 12:48:00 +02:00
|
|
|
m_toolButton = new QToolButton(this);
|
|
|
|
|
m_toolButton->setAutoRaise(false);
|
|
|
|
|
|
|
|
|
|
m_toolButton->setIcon(QPixmap::fromImage(QImage(line_xpm)));
|
|
|
|
|
m_toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
|
|
|
m_toolButton->setFixedSize(16, 16);
|
|
|
|
|
|
|
|
|
|
if (Internal::BauhausPlugin::pluginInstance()->settings().pinContextPane)
|
|
|
|
|
setPinButton();
|
|
|
|
|
else
|
|
|
|
|
setLineButton();
|
|
|
|
|
|
|
|
|
|
m_toolButton->setToolTip(tr("Hides this toolbar. This toolbar can be permantly disabled in the options or in the context menu."));
|
|
|
|
|
connect(m_toolButton, SIGNAL(clicked()), this, SLOT(onTogglePane()));
|
|
|
|
|
layout->addWidget(m_toolButton, 0, 0, 1, 1);
|
2010-07-06 11:05:43 +02:00
|
|
|
colorDialog();
|
|
|
|
|
|
|
|
|
|
QWidget *fontWidget = createFontWidget();
|
|
|
|
|
m_currentWidget = fontWidget;
|
2010-07-15 16:44:53 +02:00
|
|
|
QWidget *imageWidget = createImageWidget();
|
2010-07-30 14:30:19 +02:00
|
|
|
QWidget *borderImageWidget = createBorderImageWidget();
|
2010-07-15 16:44:53 +02:00
|
|
|
QWidget *rectangleWidget = createRectangleWidget();
|
2010-07-19 12:06:40 +02:00
|
|
|
QWidget *easingWidget = createEasingWidget();
|
2010-07-06 11:05:43 +02:00
|
|
|
layout->addWidget(fontWidget, 0, 1, 2, 1);
|
2010-07-19 12:06:40 +02:00
|
|
|
layout->addWidget(easingWidget, 0, 1, 2, 1);
|
2010-07-15 16:44:53 +02:00
|
|
|
layout->addWidget(imageWidget, 0, 1, 2, 1);
|
2010-07-30 14:30:19 +02:00
|
|
|
layout->addWidget(borderImageWidget, 0, 1, 2, 1);
|
2010-07-15 16:44:53 +02:00
|
|
|
layout->addWidget(rectangleWidget, 0, 1, 2, 1);
|
2010-07-19 12:06:40 +02:00
|
|
|
|
2010-07-06 11:05:43 +02:00
|
|
|
setAutoFillBackground(true);
|
|
|
|
|
setContextMenuPolicy(Qt::ActionsContextMenu);
|
|
|
|
|
|
2010-08-02 17:10:16 +02:00
|
|
|
m_resetAction = new QAction(tr("Pin toolbar"), this);
|
|
|
|
|
m_resetAction->setCheckable(true);
|
2010-08-03 12:48:00 +02:00
|
|
|
addAction(m_resetAction.data());
|
|
|
|
|
connect(m_resetAction.data(), SIGNAL(triggered(bool)), this, SLOT(onResetPosition(bool)));
|
2010-07-07 13:07:47 +02:00
|
|
|
|
2010-08-04 13:56:34 +02:00
|
|
|
m_disableAction = new QAction(tr("Show depending on context"), this);
|
|
|
|
|
addAction(m_disableAction.data());
|
|
|
|
|
m_disableAction->setCheckable(true);
|
|
|
|
|
connect(m_disableAction.data(), SIGNAL(toggled(bool)), this, SLOT(onDisable(bool)));
|
2010-08-03 12:48:00 +02:00
|
|
|
m_pinned = false;
|
2010-07-06 11:05:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextPaneWidget::~ContextPaneWidget()
|
|
|
|
|
{
|
|
|
|
|
//if the pane was never activated the widget is not in a widget tree
|
|
|
|
|
if (!m_bauhausColorDialog.isNull())
|
|
|
|
|
delete m_bauhausColorDialog.data();
|
|
|
|
|
m_bauhausColorDialog.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-09 15:56:43 +02:00
|
|
|
void ContextPaneWidget::activate(const QPoint &pos, const QPoint &alternative, const QPoint &alternative2)
|
2010-07-06 11:05:43 +02:00
|
|
|
{
|
|
|
|
|
//uncheck all color buttons
|
|
|
|
|
foreach (ColorButton *colorButton, findChildren<ColorButton*>()) {
|
|
|
|
|
colorButton->setChecked(false);
|
|
|
|
|
}
|
2010-07-22 13:35:38 +02:00
|
|
|
show();
|
|
|
|
|
update();
|
2010-07-06 11:05:43 +02:00
|
|
|
resize(sizeHint());
|
|
|
|
|
show();
|
2010-07-09 15:56:43 +02:00
|
|
|
rePosition(pos, alternative, alternative2);
|
2010-07-06 11:05:43 +02:00
|
|
|
raise();
|
2010-08-02 17:10:16 +02:00
|
|
|
m_resetAction->setChecked(Internal::BauhausPlugin::pluginInstance()->settings().pinContextPane);
|
2010-08-04 13:56:34 +02:00
|
|
|
m_disableAction->setChecked(Internal::BauhausPlugin::pluginInstance()->settings().enableContextPane);
|
2010-07-06 11:05:43 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-09 15:56:43 +02:00
|
|
|
void ContextPaneWidget::rePosition(const QPoint &position, const QPoint &alternative, const QPoint &alternative2)
|
2010-07-06 11:05:43 +02:00
|
|
|
{
|
2010-07-09 15:56:43 +02:00
|
|
|
if ((position.x() + width()) < parentWidget()->width())
|
2010-07-06 11:05:43 +02:00
|
|
|
move(position);
|
|
|
|
|
else
|
|
|
|
|
move(alternative);
|
|
|
|
|
|
2010-07-09 15:56:43 +02:00
|
|
|
if (pos().y() < 0)
|
|
|
|
|
move(alternative2);
|
2010-07-20 15:01:50 +02:00
|
|
|
if ((pos().y() + height()) > parentWidget()->height())
|
|
|
|
|
hide();
|
2010-07-22 13:35:38 +02:00
|
|
|
|
|
|
|
|
m_originalPos = pos();
|
|
|
|
|
|
2010-08-02 17:10:16 +02:00
|
|
|
if (m_pos.x() > 0 && (Internal::BauhausPlugin::pluginInstance()->settings().pinContextPane)) {
|
2010-07-22 13:35:38 +02:00
|
|
|
move(m_pos);
|
|
|
|
|
show();
|
2010-08-03 12:48:00 +02:00
|
|
|
setPinButton();
|
|
|
|
|
} else {
|
|
|
|
|
setLineButton();
|
2010-07-22 13:35:38 +02:00
|
|
|
}
|
2010-07-06 11:05:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ContextPaneWidget::deactivate()
|
|
|
|
|
{
|
|
|
|
|
hide();
|
|
|
|
|
if (m_bauhausColorDialog)
|
|
|
|
|
m_bauhausColorDialog->hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BauhausColorDialog *ContextPaneWidget::colorDialog()
|
|
|
|
|
{
|
|
|
|
|
if (m_bauhausColorDialog.isNull()) {
|
|
|
|
|
m_bauhausColorDialog = new BauhausColorDialog(parentWidget());
|
|
|
|
|
m_bauhausColorDialog->hide();
|
2010-07-26 13:47:59 +02:00
|
|
|
setSecondaryTarget(m_bauhausColorDialog.data());
|
2010-07-06 11:05:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return m_bauhausColorDialog.data();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ContextPaneWidget::setProperties(::QmlJS::PropertyReader *propertyReader)
|
|
|
|
|
{
|
|
|
|
|
ContextPaneTextWidget *textWidget = qobject_cast<ContextPaneTextWidget*>(m_currentWidget);
|
|
|
|
|
if (textWidget)
|
|
|
|
|
textWidget->setProperties(propertyReader);
|
2010-07-15 16:44:53 +02:00
|
|
|
|
2010-07-19 12:06:40 +02:00
|
|
|
EasingContextPane *easingWidget = qobject_cast<EasingContextPane*>(m_currentWidget);
|
|
|
|
|
if (easingWidget)
|
|
|
|
|
easingWidget->setProperties(propertyReader);
|
|
|
|
|
|
2010-07-15 16:44:53 +02:00
|
|
|
ContextPaneWidgetImage *imageWidget = qobject_cast<ContextPaneWidgetImage*>(m_currentWidget);
|
|
|
|
|
if (imageWidget)
|
|
|
|
|
imageWidget->setProperties(propertyReader);
|
|
|
|
|
|
|
|
|
|
ContextPaneWidgetRectangle *rectangleWidget = qobject_cast<ContextPaneWidgetRectangle*>(m_currentWidget);
|
|
|
|
|
if (rectangleWidget)
|
|
|
|
|
rectangleWidget->setProperties(propertyReader);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ContextPaneWidget::setPath(const QString &path)
|
|
|
|
|
{
|
|
|
|
|
ContextPaneWidgetImage *imageWidget = qobject_cast<ContextPaneWidgetImage*>(m_currentWidget);
|
|
|
|
|
if (imageWidget)
|
|
|
|
|
imageWidget->setPath(path);
|
|
|
|
|
|
2010-07-06 11:05:43 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-05 17:42:15 +02:00
|
|
|
bool ContextPaneWidget::setType(const QStringList &types)
|
2010-07-06 11:05:43 +02:00
|
|
|
{
|
2010-07-15 16:44:53 +02:00
|
|
|
m_imageWidget->hide();
|
2010-07-30 14:30:19 +02:00
|
|
|
m_borderImageWidget->hide();
|
2010-07-15 16:44:53 +02:00
|
|
|
m_textWidget->hide();
|
|
|
|
|
m_rectangleWidget->hide();
|
2010-07-19 12:06:40 +02:00
|
|
|
m_easingWidget->hide();
|
2010-07-15 16:44:53 +02:00
|
|
|
|
2010-08-05 17:42:15 +02:00
|
|
|
if (types.contains("Text")) {
|
2010-07-06 11:05:43 +02:00
|
|
|
m_currentWidget = m_textWidget;
|
|
|
|
|
m_textWidget->show();
|
|
|
|
|
m_textWidget->setStyleVisible(true);
|
|
|
|
|
m_textWidget->setVerticalAlignmentVisible(true);
|
2010-08-05 17:42:15 +02:00
|
|
|
if (types.contains("TextInput")) {
|
2010-07-06 11:05:43 +02:00
|
|
|
m_textWidget->setVerticalAlignmentVisible(false);
|
|
|
|
|
m_textWidget->setStyleVisible(false);
|
2010-08-05 17:42:15 +02:00
|
|
|
} else if (types.contains("TextEdit")) {
|
2010-07-06 11:05:43 +02:00
|
|
|
m_textWidget->setStyleVisible(false);
|
|
|
|
|
}
|
2010-07-22 13:35:38 +02:00
|
|
|
resize(sizeHint());
|
2010-07-06 11:05:43 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-07-19 12:06:40 +02:00
|
|
|
|
2010-08-05 17:42:15 +02:00
|
|
|
if (m_easingWidget->acceptsType(types)) {
|
2010-07-19 12:06:40 +02:00
|
|
|
m_currentWidget = m_easingWidget;
|
|
|
|
|
m_easingWidget->show();
|
2010-07-22 13:35:38 +02:00
|
|
|
resize(sizeHint());
|
2010-07-19 12:06:40 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-08-05 17:42:15 +02:00
|
|
|
if (types.contains("Rectangle")) {
|
2010-07-15 16:44:53 +02:00
|
|
|
m_currentWidget = m_rectangleWidget;
|
|
|
|
|
m_rectangleWidget->show();
|
2010-07-22 13:35:38 +02:00
|
|
|
resize(sizeHint());
|
2010-07-15 16:44:53 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-07-30 14:30:19 +02:00
|
|
|
|
2010-08-05 17:42:15 +02:00
|
|
|
if (types.contains("BorderImage")) {
|
2010-07-30 14:30:19 +02:00
|
|
|
m_currentWidget = m_borderImageWidget;
|
|
|
|
|
m_borderImageWidget->show();
|
|
|
|
|
resize(sizeHint());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-05 17:42:15 +02:00
|
|
|
if (types.contains("Image")) {
|
2010-07-15 16:44:53 +02:00
|
|
|
m_currentWidget = m_imageWidget;
|
|
|
|
|
m_imageWidget->show();
|
2010-07-22 13:35:38 +02:00
|
|
|
resize(sizeHint());
|
2010-07-15 16:44:53 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2010-07-06 11:05:43 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-05 17:42:15 +02:00
|
|
|
bool ContextPaneWidget::acceptsType(const QStringList &types)
|
2010-07-19 12:06:40 +02:00
|
|
|
{
|
2010-08-05 17:42:15 +02:00
|
|
|
return types.contains("Text") || m_easingWidget->acceptsType(types) ||
|
2010-08-06 10:54:47 +02:00
|
|
|
types.contains("Rectangle") || types.contains("Image") || types.contains("BorderImage");
|
2010-07-19 12:06:40 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-06 11:05:43 +02:00
|
|
|
void ContextPaneWidget::onTogglePane()
|
|
|
|
|
{
|
|
|
|
|
if (!m_currentWidget)
|
|
|
|
|
return;
|
2010-08-03 12:48:00 +02:00
|
|
|
if (m_pinned) {
|
|
|
|
|
m_pos = QPoint(-1,-1);
|
|
|
|
|
move(m_originalPos);
|
|
|
|
|
setLineButton();
|
|
|
|
|
} else {
|
|
|
|
|
deactivate();
|
|
|
|
|
}
|
2010-07-06 11:05:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ContextPaneWidget::onShowColorDialog(bool checked, const QPoint &p)
|
|
|
|
|
{
|
|
|
|
|
if (checked) {
|
|
|
|
|
colorDialog()->setParent(parentWidget());
|
|
|
|
|
colorDialog()->move(p);
|
|
|
|
|
colorDialog()->show();
|
|
|
|
|
colorDialog()->raise();
|
|
|
|
|
} else {
|
|
|
|
|
colorDialog()->hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-04 13:56:34 +02:00
|
|
|
void ContextPaneWidget::onDisable(bool b)
|
2010-07-06 11:05:43 +02:00
|
|
|
{
|
|
|
|
|
DesignerSettings designerSettings = Internal::BauhausPlugin::pluginInstance()->settings();
|
2010-08-04 13:56:34 +02:00
|
|
|
designerSettings.enableContextPane = b;
|
2010-07-06 11:05:43 +02:00
|
|
|
Internal::BauhausPlugin::pluginInstance()->setSettings(designerSettings);
|
2010-08-04 13:56:34 +02:00
|
|
|
if (!b) {
|
|
|
|
|
hide();
|
|
|
|
|
colorDialog()->hide();
|
|
|
|
|
}
|
2010-07-06 11:05:43 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-02 17:10:16 +02:00
|
|
|
void ContextPaneWidget::onResetPosition(bool toggle)
|
2010-07-07 13:07:47 +02:00
|
|
|
{
|
2010-08-02 17:10:16 +02:00
|
|
|
if (!toggle) {
|
2010-08-03 12:48:00 +02:00
|
|
|
setLineButton();
|
2010-08-02 17:10:16 +02:00
|
|
|
m_pos = QPoint(-1,-1);
|
|
|
|
|
move(m_originalPos);
|
2010-08-03 12:48:00 +02:00
|
|
|
} else {
|
|
|
|
|
setPinButton();
|
2010-08-02 17:10:16 +02:00
|
|
|
}
|
2010-07-07 13:07:47 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-03 12:48:00 +02:00
|
|
|
void ContextPaneWidget::protectedMoved()
|
|
|
|
|
{
|
|
|
|
|
setPinButton();
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-06 11:05:43 +02:00
|
|
|
QWidget* ContextPaneWidget::createFontWidget()
|
|
|
|
|
{
|
|
|
|
|
m_textWidget = new ContextPaneTextWidget(this);
|
|
|
|
|
connect(m_textWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant)));
|
|
|
|
|
connect(m_textWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString)));
|
2010-07-15 16:44:53 +02:00
|
|
|
connect(m_textWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)));
|
2010-07-06 11:05:43 +02:00
|
|
|
|
|
|
|
|
return m_textWidget;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-19 12:06:40 +02:00
|
|
|
QWidget* ContextPaneWidget::createEasingWidget()
|
|
|
|
|
{
|
|
|
|
|
m_easingWidget = new EasingContextPane(this);
|
|
|
|
|
|
|
|
|
|
connect(m_easingWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant)));
|
|
|
|
|
connect(m_easingWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString)));
|
2010-07-19 13:37:34 +02:00
|
|
|
connect(m_easingWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant,bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)));
|
2010-07-19 12:06:40 +02:00
|
|
|
|
|
|
|
|
return m_easingWidget;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-15 16:44:53 +02:00
|
|
|
QWidget *ContextPaneWidget::createImageWidget()
|
|
|
|
|
{
|
|
|
|
|
m_imageWidget = new ContextPaneWidgetImage(this);
|
|
|
|
|
connect(m_imageWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant)));
|
|
|
|
|
connect(m_imageWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString)));
|
|
|
|
|
connect(m_imageWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)));
|
|
|
|
|
|
|
|
|
|
return m_imageWidget;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-30 14:30:19 +02:00
|
|
|
QWidget *ContextPaneWidget::createBorderImageWidget()
|
|
|
|
|
{
|
|
|
|
|
m_borderImageWidget = new ContextPaneWidgetImage(this, true);
|
|
|
|
|
connect(m_borderImageWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant)));
|
|
|
|
|
connect(m_borderImageWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString)));
|
|
|
|
|
connect(m_borderImageWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)));
|
|
|
|
|
|
|
|
|
|
return m_borderImageWidget;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-15 16:44:53 +02:00
|
|
|
QWidget *ContextPaneWidget::createRectangleWidget()
|
|
|
|
|
{
|
|
|
|
|
m_rectangleWidget = new ContextPaneWidgetRectangle(this);
|
|
|
|
|
connect(m_rectangleWidget, SIGNAL(propertyChanged(QString,QVariant)), this, SIGNAL(propertyChanged(QString,QVariant)));
|
|
|
|
|
connect(m_rectangleWidget, SIGNAL(removeProperty(QString)), this, SIGNAL(removeProperty(QString)));
|
|
|
|
|
connect(m_rectangleWidget, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)), this, SIGNAL(removeAndChangeProperty(QString,QString,QVariant, bool)));
|
|
|
|
|
|
|
|
|
|
return m_rectangleWidget;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-03 12:48:00 +02:00
|
|
|
void ContextPaneWidget::setPinButton()
|
|
|
|
|
{
|
|
|
|
|
m_toolButton->setAutoRaise(true);
|
|
|
|
|
m_pinned = true;
|
|
|
|
|
|
|
|
|
|
m_toolButton->setIcon(QPixmap::fromImage(QImage(pin_xpm)));
|
|
|
|
|
m_toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
2010-08-04 14:02:51 +02:00
|
|
|
m_toolButton->setFixedSize(20, 20);
|
2010-08-03 12:48:00 +02:00
|
|
|
m_toolButton->setToolTip(tr("Unpins the toolbar. The toolbar will be moved to its default position."));
|
|
|
|
|
|
|
|
|
|
DesignerSettings designerSettings = Internal::BauhausPlugin::pluginInstance()->settings();
|
|
|
|
|
designerSettings.pinContextPane = true;
|
|
|
|
|
Internal::BauhausPlugin::pluginInstance()->setSettings(designerSettings);
|
|
|
|
|
if (m_resetAction) {
|
|
|
|
|
m_resetAction->blockSignals(true);
|
|
|
|
|
m_resetAction->setChecked(true);
|
|
|
|
|
m_resetAction->blockSignals(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ContextPaneWidget::setLineButton()
|
|
|
|
|
{
|
|
|
|
|
m_pinned = false;
|
|
|
|
|
m_toolButton->setAutoRaise(true);
|
|
|
|
|
m_toolButton->setIcon(QPixmap::fromImage(QImage(line_xpm)));
|
|
|
|
|
m_toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
2010-08-04 14:02:51 +02:00
|
|
|
m_toolButton->setFixedSize(20, 20);
|
2010-08-03 12:48:00 +02:00
|
|
|
m_toolButton->setToolTip(tr("Hides this toolbar. This toolbar can be permantly disabled in the options or in the context menu."));
|
|
|
|
|
|
|
|
|
|
DesignerSettings designerSettings = Internal::BauhausPlugin::pluginInstance()->settings();
|
|
|
|
|
designerSettings.pinContextPane = false;
|
|
|
|
|
Internal::BauhausPlugin::pluginInstance()->setSettings(designerSettings);
|
|
|
|
|
if (m_resetAction) {
|
|
|
|
|
m_resetAction->blockSignals(true);
|
|
|
|
|
m_resetAction->setChecked(false);
|
|
|
|
|
m_resetAction->blockSignals(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-07-06 11:05:43 +02:00
|
|
|
|
|
|
|
|
} //QmlDesigner
|
|
|
|
|
|
|
|
|
|
|