mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
starting HFControls
This commit is contained in:
parent
bb5e62dafd
commit
2a6252584f
7 changed files with 116 additions and 39 deletions
|
@ -30,7 +30,9 @@ foreach(plugin ${Qt5Gui_PLUGINS})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(src_files
|
set(src_files
|
||||||
src/main.cpp)
|
src/main.cpp
|
||||||
|
src/LauncherWindow.h
|
||||||
|
src/LauncherWindow.cpp)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${src_files})
|
add_executable(${PROJECT_NAME} ${src_files})
|
||||||
|
|
||||||
|
|
30
launchers/qt/resources/qml/HFControls/HFButton.qml
Normal file
30
launchers/qt/resources/qml/HFControls/HFButton.qml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import QtQuick 2.3
|
||||||
|
import QtQuick.Controls 2.1
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: control
|
||||||
|
property string backgroundColor: "#00000000"
|
||||||
|
property string borderColor: "#FFFFFF"
|
||||||
|
property string textColor: "#FFFFFF"
|
||||||
|
property int backgroundOpacity: 1
|
||||||
|
property int backgroundRadius: 1
|
||||||
|
property int backgroundWidth: 2
|
||||||
|
background: Rectangle {
|
||||||
|
implicitWidth: 100
|
||||||
|
implicitHeight: 40
|
||||||
|
color: control.backgroundColor
|
||||||
|
opacity: control.backgroundOpacity
|
||||||
|
border.color: control.borderColor
|
||||||
|
border.width: control.backgroundWidth
|
||||||
|
radius: control.backgroundRadius
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Text {
|
||||||
|
text: control.text
|
||||||
|
font: control.font
|
||||||
|
color: control.textColor
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
}
|
27
launchers/qt/resources/qml/HFControls/HFTextField.qml
Normal file
27
launchers/qt/resources/qml/HFControls/HFTextField.qml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import QtQuick 2.3
|
||||||
|
import QtQuick.Controls 2.1
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: control
|
||||||
|
color: "#FFFFFF"
|
||||||
|
font.family: "Graphik Medium"
|
||||||
|
font.pixelSize: 22
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
horizontalAlignment: TextInput.AlignLeft
|
||||||
|
placeholderText: "PlaceHolder"
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
property string seperatorColor: "#FFFFFF"
|
||||||
|
background: Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
Rectangle {
|
||||||
|
anchors {
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 7
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
height: 1
|
||||||
|
color: control.seperatorColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import QtQuick 2.3
|
import QtQuick 2.3
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
|
import "HFControls"
|
||||||
Image {
|
Image {
|
||||||
id: root
|
id: root
|
||||||
width: 515
|
width: 515
|
||||||
|
@ -23,11 +24,10 @@ Image {
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
HFTextField {
|
||||||
id: textField
|
id: textField
|
||||||
background: Rectangle {
|
width: 150
|
||||||
color: "#00000000"
|
height: 50
|
||||||
}
|
|
||||||
anchors {
|
anchors {
|
||||||
left: root.left
|
left: root.left
|
||||||
leftMargin: 40
|
leftMargin: 40
|
||||||
|
@ -38,21 +38,8 @@ Image {
|
||||||
placeholderText: "Organization"
|
placeholderText: "Organization"
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: seperator
|
|
||||||
anchors {
|
|
||||||
left: textField.left
|
|
||||||
right: textField.right
|
|
||||||
top: textField.bottom
|
|
||||||
topMargin: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
height: 1
|
HFButton {
|
||||||
color: "#FFFFFF"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors {
|
anchors {
|
||||||
left: root.left
|
left: root.left
|
||||||
leftMargin: 40
|
leftMargin: 40
|
||||||
|
@ -61,15 +48,6 @@ Image {
|
||||||
}
|
}
|
||||||
id: button
|
id: button
|
||||||
text: "NEXT"
|
text: "NEXT"
|
||||||
background: Rectangle {
|
|
||||||
implicitWidth: 100
|
|
||||||
implicitHeight: 40
|
|
||||||
color: "#00000000"
|
|
||||||
opacity: 1
|
|
||||||
border.color: "#FFFFFF"
|
|
||||||
border.width: 4
|
|
||||||
radius: 2
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
31
launchers/qt/src/LauncherWindow.cpp
Normal file
31
launchers/qt/src/LauncherWindow.cpp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#include "LauncherWindow.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
void LauncherWindow::keyPressEvent(QKeyEvent* event) {
|
||||||
|
QQuickView::keyPressEvent(event);
|
||||||
|
if (!event->isAccepted()) {
|
||||||
|
std::cout << "Key press event\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LauncherWindow::mousePressEvent(QMouseEvent* event) {
|
||||||
|
QQuickView::mousePressEvent(event);
|
||||||
|
if (!event->isAccepted()) {
|
||||||
|
std::cout << "mouse press event\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LauncherWindow::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
|
QQuickView::mouseReleaseEvent(event);
|
||||||
|
if (!event->isAccepted()) {
|
||||||
|
std::cout << "mouse release event\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LauncherWindow::mouseMoveEvent(QMouseEvent* event) {
|
||||||
|
QQuickView::mouseMoveEvent(event);
|
||||||
|
if (!event->isAccepted()) {
|
||||||
|
std::cout << "mouse move event\n";
|
||||||
|
}
|
||||||
|
}
|
10
launchers/qt/src/LauncherWindow.h
Normal file
10
launchers/qt/src/LauncherWindow.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#include <QQuickView>
|
||||||
|
|
||||||
|
|
||||||
|
class LauncherWindow : public QQuickView {
|
||||||
|
public:
|
||||||
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
|
void mousePressEvent(QMouseEvent* event) override;
|
||||||
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent* event) override;
|
||||||
|
};
|
|
@ -1,10 +1,11 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QQuickView>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QResource>
|
#include <QResource>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
#include "LauncherWindow.h"
|
||||||
//Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
|
//Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
|
||||||
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
||||||
Q_IMPORT_PLUGIN(QtQuick2Plugin);
|
Q_IMPORT_PLUGIN(QtQuick2Plugin);
|
||||||
|
@ -12,10 +13,7 @@ Q_IMPORT_PLUGIN(QtQuickControls2Plugin);
|
||||||
Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin);
|
Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin);
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QString name { "QtExamples" };
|
QString name { "HQLauncher" };
|
||||||
|
|
||||||
|
|
||||||
std::cout << "Hello world\n";
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QCoreApplication::setOrganizationName(name);
|
QCoreApplication::setOrganizationName(name);
|
||||||
|
|
||||||
|
@ -24,12 +22,13 @@ int main(int argc, char *argv[])
|
||||||
QString resourceBinaryLocation = QGuiApplication::applicationDirPath() + "/resources.rcc";
|
QString resourceBinaryLocation = QGuiApplication::applicationDirPath() + "/resources.rcc";
|
||||||
QResource::registerResource(resourceBinaryLocation);
|
QResource::registerResource(resourceBinaryLocation);
|
||||||
|
|
||||||
QQuickView view;
|
LauncherWindow launcherWindow;
|
||||||
view.setFlags(Qt::FramelessWindowHint);
|
launcherWindow.setFlags(Qt::FramelessWindowHint);
|
||||||
view.setSource(QUrl("qrc:/qml/root.qml"));
|
launcherWindow.setSource(QUrl("qrc:/qml/root.qml"));
|
||||||
if (view.status() == QQuickView::Error)
|
if (launcherWindow.status() == QQuickView::Error) {
|
||||||
return -1;
|
return -1;
|
||||||
view.setResizeMode(QQuickView::SizeRootObjectToView);
|
}
|
||||||
view.show();
|
launcherWindow.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||||
|
launcherWindow.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue