can now add new components
This commit is contained in:
parent
edf6a0ad2b
commit
96f2cffbcc
|
@ -16,9 +16,7 @@ Component::Component(QWidget* parent, const QString& resource) :
|
||||||
ui = new Ui::Component();
|
ui = new Ui::Component();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->label->setPixmap(QPixmap(":/components/and.png"));
|
ui->label->setPixmap(QPixmap(resource));
|
||||||
|
|
||||||
std::cout << "Created Component --" << ui->label->pos().x() << ", " << ui->label->pos().y() << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Component::mouseMoveEvent(QMouseEvent* event)
|
void Component::mouseMoveEvent(QMouseEvent* event)
|
||||||
|
|
|
@ -62,17 +62,13 @@ void Window::mousePressEvent(QMouseEvent* event)
|
||||||
if (child != nullptr)
|
if (child != nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// So Qt can't add widgets outside of the constructor apparently
|
|
||||||
// So component cannot be a QFrame, it will have to become just a normal object
|
|
||||||
// And I need one of these open gl gsjdööööööööööööööl<
|
|
||||||
// TODO: I'll just let this leak for now, I just wanna eat dinner...
|
// TODO: I'll just let this leak for now, I just wanna eat dinner...
|
||||||
Component* leak = new Component(this, resourcePath);
|
Component* leak = new Component(this, resourcePath);
|
||||||
QPoint pos = event->pos() - QPoint {50, 25};
|
QPoint pos = event->pos() - QPoint {50, 25};
|
||||||
leak->setGeometry(QRect(280, 160, 100, 50));
|
leak->setGeometry(QRect(pos.x(), pos.y(), 100, 50));
|
||||||
leak->setFrameShape(QFrame::StyledPanel);
|
leak->setFrameShape(QFrame::NoFrame);
|
||||||
leak->setFrameShadow(QFrame::Raised);
|
leak->setFrameShadow(QFrame::Plain);
|
||||||
|
leak->setVisible(true);
|
||||||
std::cout << leak->pos().x() << ", " << leak->pos().y() << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +114,7 @@ void Window::LoadGhostLabel(const QString& resource)
|
||||||
ghostImage = new GhostLabel(this);
|
ghostImage = new GhostLabel(this);
|
||||||
ghostImage->setGeometry({ 0, 0, 100, 50 });
|
ghostImage->setGeometry({ 0, 0, 100, 50 });
|
||||||
ghostImage->setScaledContents(true);
|
ghostImage->setScaledContents(true);
|
||||||
|
ghostImage->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainter p;
|
QPainter p;
|
||||||
|
|
27
ui/Window.ui
27
ui/Window.ui
|
@ -16,24 +16,7 @@
|
||||||
<property name="dockOptions">
|
<property name="dockOptions">
|
||||||
<set>QMainWindow::AnimatedDocks</set>
|
<set>QMainWindow::AnimatedDocks</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget"/>
|
||||||
<widget class="Component" name="frame">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>360</x>
|
|
||||||
<y>180</y>
|
|
||||||
<width>120</width>
|
|
||||||
<height>80</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -106,14 +89,6 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>Component</class>
|
|
||||||
<extends>QFrame</extends>
|
|
||||||
<header>Component.hpp</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources>
|
<resources>
|
||||||
<include location="assets/resources.qrc"/>
|
<include location="assets/resources.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue