Commit 90b37961 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: adding reset position to context widget

parent 67a65d9b
...@@ -48,9 +48,13 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : QFrame(parent), m_curren ...@@ -48,9 +48,13 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : QFrame(parent), m_curren
setAutoFillBackground(true); setAutoFillBackground(true);
setContextMenuPolicy(Qt::ActionsContextMenu); setContextMenuPolicy(Qt::ActionsContextMenu);
QAction *resetAction = new QAction(tr("Reset position"), this);
addAction(resetAction);
connect(resetAction, SIGNAL(triggered()), this, SLOT(onResetPosition()));
QAction *disableAction = new QAction(tr("Disable permanently"), this); QAction *disableAction = new QAction(tr("Disable permanently"), this);
addAction(disableAction); addAction(disableAction);
connect(disableAction, SIGNAL(triggered()), this, SLOT(onDisable())); connect(disableAction, SIGNAL(triggered()), this, SLOT(onDisable()));
} }
ContextPaneWidget::~ContextPaneWidget() ContextPaneWidget::~ContextPaneWidget()
...@@ -80,6 +84,7 @@ void ContextPaneWidget::rePosition(const QPoint &position, const QPoint &alterna ...@@ -80,6 +84,7 @@ void ContextPaneWidget::rePosition(const QPoint &position, const QPoint &alterna
else else
move(alternative); move(alternative);
m_originalPos = pos();
if (m_xPos > 0) if (m_xPos > 0)
move(m_xPos, pos().y()); move(m_xPos, pos().y());
} }
...@@ -198,6 +203,12 @@ void ContextPaneWidget::onDisable() ...@@ -198,6 +203,12 @@ void ContextPaneWidget::onDisable()
colorDialog()->hide(); colorDialog()->hide();
} }
void ContextPaneWidget::onResetPosition()
{
move(m_originalPos);
m_xPos = -1;
}
QWidget* ContextPaneWidget::createFontWidget() QWidget* ContextPaneWidget::createFontWidget()
{ {
m_textWidget = new ContextPaneTextWidget(this); m_textWidget = new ContextPaneTextWidget(this);
......
...@@ -41,6 +41,7 @@ signals: ...@@ -41,6 +41,7 @@ signals:
private slots: private slots:
void onDisable(); void onDisable();
void onResetPosition();
protected: protected:
QWidget *createFontWidget(); QWidget *createFontWidget();
...@@ -57,6 +58,7 @@ private: ...@@ -57,6 +58,7 @@ private:
QWeakPointer<BauhausColorDialog> m_bauhausColorDialog; QWeakPointer<BauhausColorDialog> m_bauhausColorDialog;
QString m_colorName; QString m_colorName;
int m_xPos; int m_xPos;
QPoint m_originalPos;
}; };
} //QmlDesigner } //QmlDesigner
......
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