Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

making some tests to add some settings.. (not really a cool-device bu…

…t I didnt want to try on master
  • Loading branch information...
commit b793dcccf46f451269f2bd7d89bb655c1e820119 1 parent e5bd885
Clovis Scotti authored
View
31 PushBurton2/graphicssettings.cpp
@@ -41,6 +41,11 @@ GraphicsSettings::GraphicsSettings(PushDevicesHolder* devs, QObject* parent=0) :
startLiveViewBt = new GraphicTextBt("LIVE VIEW (DEBUG)", this);
startLiveViewBt->setPos(110+5,0);
connect(startLiveViewBt, SIGNAL(activated()), this, SLOT(start_live_view()));
+
+ userNameField = 0;
+ proxy2edit = 0;
+ connect(this, SIGNAL(yChanged()), this, SLOT(panelPosUpdate()));
+
}
GraphicsSettings::~GraphicsSettings()
@@ -95,3 +100,29 @@ void GraphicsSettings::end_live_view()
liveView->deleteLater();
liveView = 0;
}
+
+void GraphicsSettings::initForm()
+{
+ userNameField = new QLineEdit("Username");
+ if(this->scene()){
+ proxy2edit = this->scene()->addWidget(userNameField);
+ userNameField->setGeometry(0,0,150, 20);
+ proxy2edit->setVisible(true);
+ proxy2edit->setZValue(2);
+ proxy2edit->setPos(this->pos());
+ qDebug() << "Added line edit to scene! hahaha";
+ } else {
+ qDebug() << "no scene!";
+ delete userNameField;
+ }
+
+}
+
+
+void GraphicsSettings::panelPosUpdate()
+{
+ if(userNameField) {
+ proxy2edit->setPos(this->x()+40, this->y()+120);
+ qDebug() << "Set position to " << proxy2edit->pos().y();
+ }
+}
View
11 PushBurton2/graphicssettings.h
@@ -35,6 +35,10 @@
#include <QDebug>
+#include <QLineEdit>
+#include <QGraphicsProxyWidget>
+#include <QGraphicsScene>
+
#include "pushdevicesholder.h"
//Gambiarra, xunxo, workaround... (LiveView)
@@ -50,18 +54,25 @@ class GraphicsSettings : public QGraphicsObject
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *,QWidget *);
+ void initForm();
+
private:
GraphicTextBt * startLiveViewBt;
GraphicPixmapBt * homeBt;
LiveView * liveView;
PushDevicesHolder * configuredDevices;
+ QLineEdit * userNameField;
+ QGraphicsProxyWidget * proxy2edit;
+
signals:
void home_bt_clicked();
private slots:
void start_live_view();
void end_live_view();
+
+ void panelPosUpdate();
};
#endif // GRAPHICSSETTINGS_H
View
1  PushBurton2/mainwindow.cpp
@@ -165,6 +165,7 @@ void MainWindow::fillStatesProperties()
settingsView = new GraphicsSettings(&devicesHolder, this);
settingsView->setPos(10,-450);
scene->addItem(settingsView);
+ settingsView->initForm();
settingsUsrState->assignProperty(settingsView,"y", 5);
machine.addDefaultAnimation(new PushBurtonAnimation(settingsView, "y", settingsView));
settingsUsrState->addTransition(settingsView, SIGNAL(home_bt_clicked()), homeUsrState);
Please sign in to comment.
Something went wrong with that request. Please try again.