Added ChecklistModel, ProgressModel, DatabaseWidget and FileselectionWidget
This commit is contained in:
1 parent
43d3bf8a5d
commit
b07d78fe44
34 files changed
+1002
-28
No files matched your search
@@ -0,0 +1,30 @@
|
||||
#include "canvaswidget.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QPainter>
|
||||
|
||||
CanvasWidget::CanvasWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void CanvasWidget::setImage(const QImage &image)
|
||||
{
|
||||
m_image = image;
|
||||
repaint();
|
||||
}
|
||||
|
||||
void CanvasWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
const double scale = std::min(double(width()) / m_image.width(),
|
||||
double(height()) / m_image.height());
|
||||
|
||||
const QRect imageRect(QPoint(), m_image.size() * scale);
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(this);
|
||||
painter.drawImage(imageRect, m_image);
|
||||
painter.end();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "dbguilib_global.h"
|
||||
#include <QWidget>
|
||||
|
||||
#include <QImage>
|
||||
|
||||
class DBGUILIB_EXPORT CanvasWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit CanvasWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setImage(const QImage &image);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QImage m_image;
|
||||
};
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "databasewidget.h"
|
||||
#include "ui_databasewidget.h"
|
||||
|
||||
DatabaseWidget::DatabaseWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_ui(std::make_unique<Ui::DatabaseWidget>())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->comboBox->addItem(tr("SQLite"), "QSQLITE");
|
||||
m_ui->comboBox->addItem(tr("MySQL"), "QMYSQL");
|
||||
|
||||
// for debugging
|
||||
setDriver("QMYSQL");
|
||||
setMysqlHostname("sql7.freemysqlhosting.net");
|
||||
setMysqlUsername("sql7285815");
|
||||
setMysqlPassword("BKhysrtqKl");
|
||||
setMysqlDatabase("sql7285815");
|
||||
|
||||
// setMysqlHostname("brunner.ninja");
|
||||
|
||||
// setMysqlHostname("localhost");
|
||||
// setMysqlUsername("logtest");
|
||||
// setMysqlPassword("logtest");
|
||||
// setMysqlDatabase("logtest");
|
||||
}
|
||||
|
||||
DatabaseWidget::~DatabaseWidget() = default;
|
||||
|
||||
QString DatabaseWidget::driver() const
|
||||
{
|
||||
return m_ui->comboBox->currentData().toString();
|
||||
}
|
||||
|
||||
void DatabaseWidget::setDriver(const QString &driver)
|
||||
{
|
||||
m_ui->comboBox->setCurrentIndex(m_ui->comboBox->findData(driver));
|
||||
}
|
||||
|
||||
QString DatabaseWidget::sqliteFilepath() const
|
||||
{
|
||||
return m_ui->fileSelectionWidget->path();
|
||||
}
|
||||
|
||||
void DatabaseWidget::setSqliteFilepath(const QString &sqliteFilepath)
|
||||
{
|
||||
m_ui->fileSelectionWidget->setPath(sqliteFilepath);
|
||||
}
|
||||
|
||||
QString DatabaseWidget::mysqlHostname() const
|
||||
{
|
||||
return m_ui->lineEditHostname->text();
|
||||
}
|
||||
|
||||
void DatabaseWidget::setMysqlHostname(const QString &mysqlHostname)
|
||||
{
|
||||
m_ui->lineEditHostname->setText(mysqlHostname);
|
||||
}
|
||||
|
||||
QString DatabaseWidget::mysqlUsername() const
|
||||
{
|
||||
return m_ui->lineEditUsername->text();
|
||||
}
|
||||
|
||||
void DatabaseWidget::setMysqlUsername(const QString &mysqlUsername)
|
||||
{
|
||||
m_ui->lineEditUsername->setText(mysqlUsername);
|
||||
}
|
||||
|
||||
QString DatabaseWidget::mysqlPassword() const
|
||||
{
|
||||
return m_ui->lineEditPassword->text();
|
||||
}
|
||||
|
||||
void DatabaseWidget::setMysqlPassword(const QString &mysqlPassword)
|
||||
{
|
||||
m_ui->lineEditPassword->setText(mysqlPassword);
|
||||
}
|
||||
|
||||
QString DatabaseWidget::mysqlDatabase() const
|
||||
{
|
||||
return m_ui->lineEditDatabase->text();
|
||||
}
|
||||
|
||||
void DatabaseWidget::setMysqlDatabase(const QString &mysqlDatabase)
|
||||
{
|
||||
m_ui->lineEditDatabase->setText(mysqlDatabase);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui { class DatabaseWidget; }
|
||||
|
||||
class DatabaseWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DatabaseWidget(QWidget *parent = nullptr);
|
||||
~DatabaseWidget() override;
|
||||
|
||||
QString driver() const;
|
||||
void setDriver(const QString &driver);
|
||||
|
||||
QString sqliteFilepath() const;
|
||||
void setSqliteFilepath(const QString &sqliteFilepath);
|
||||
|
||||
QString mysqlHostname() const;
|
||||
void setMysqlHostname(const QString &mysqlHostname);
|
||||
|
||||
QString mysqlUsername() const;
|
||||
void setMysqlUsername(const QString &mysqlUsername);
|
||||
|
||||
QString mysqlPassword() const;
|
||||
void setMysqlPassword(const QString &mysqlPassword);
|
||||
|
||||
QString mysqlDatabase() const;
|
||||
void setMysqlDatabase(const QString &mysqlDatabase);
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::DatabaseWidget> m_ui;
|
||||
};
|
||||
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DatabaseWidget</class>
|
||||
<widget class="QWidget" name="DatabaseWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>175</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="FileSelectionWidget" name="fileSelectionWidget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditUsername"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditHostname"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelHostname">
|
||||
<property name="text">
|
||||
<string><b>Hostname:</b></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditHostname</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelUsername">
|
||||
<property name="text">
|
||||
<string><b>Username:</b></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditUsername</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelPassword">
|
||||
<property name="text">
|
||||
<string><b>Password:</b></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditPassword</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelDatabase">
|
||||
<property name="text">
|
||||
<string><b>Database:</b></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditDatabase</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditPassword">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEditDatabase"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>FileSelectionWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/fileselectionwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>comboBox</tabstop>
|
||||
<tabstop>lineEditHostname</tabstop>
|
||||
<tabstop>lineEditUsername</tabstop>
|
||||
<tabstop>lineEditPassword</tabstop>
|
||||
<tabstop>lineEditDatabase</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>comboBox</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>stackedWidget</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>199</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>199</x>
|
||||
<y>101</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -0,0 +1,75 @@
|
||||
#include "fileselectionwidget.h"
|
||||
#include "ui_fileselectionwidget.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
FileSelectionWidget::FileSelectionWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_ui(std::make_unique<Ui::FileSelectionWidget>()),
|
||||
m_mode(Mode::OpenFile)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->lineEdit, &QLineEdit::textChanged, this, &FileSelectionWidget::pathChanged);
|
||||
connect(m_ui->pushButton, &QAbstractButton::pressed, this, &FileSelectionWidget::selectPath);
|
||||
}
|
||||
|
||||
FileSelectionWidget::FileSelectionWidget(const Mode mode, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_ui(std::make_unique<Ui::FileSelectionWidget>()),
|
||||
m_mode(mode)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->lineEdit, &QLineEdit::textChanged, this, &FileSelectionWidget::pathChanged);
|
||||
connect(m_ui->pushButton, &QAbstractButton::pressed, this, &FileSelectionWidget::selectPath);
|
||||
}
|
||||
|
||||
FileSelectionWidget::FileSelectionWidget(const Mode mode, const QString &path, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_ui(std::make_unique<Ui::FileSelectionWidget>()),
|
||||
m_mode(mode)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->lineEdit->setText(path);
|
||||
|
||||
connect(m_ui->lineEdit, &QLineEdit::textChanged, this, &FileSelectionWidget::pathChanged);
|
||||
connect(m_ui->pushButton, &QAbstractButton::pressed, this, &FileSelectionWidget::selectPath);
|
||||
}
|
||||
|
||||
FileSelectionWidget::~FileSelectionWidget() = default;
|
||||
|
||||
FileSelectionWidget::Mode FileSelectionWidget::mode() const
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
void FileSelectionWidget::setMode(const FileSelectionWidget::Mode mode)
|
||||
{
|
||||
m_mode = mode;
|
||||
}
|
||||
|
||||
QString FileSelectionWidget::path() const
|
||||
{
|
||||
return m_ui->lineEdit->text();
|
||||
}
|
||||
|
||||
void FileSelectionWidget::setPath(const QString &path)
|
||||
{
|
||||
m_ui->lineEdit->setText(path);
|
||||
}
|
||||
|
||||
void FileSelectionWidget::selectPath()
|
||||
{
|
||||
QString path;
|
||||
switch (m_mode)
|
||||
{
|
||||
case Mode::OpenFile: path = QFileDialog::getOpenFileName(this); break;
|
||||
case Mode::SaveFile: path = QFileDialog::getSaveFileName(this); break;
|
||||
case Mode::ExistingDirectory: path = QFileDialog::getExistingDirectory(this); break;
|
||||
}
|
||||
|
||||
if (!path.isEmpty())
|
||||
m_ui->lineEdit->setText(path);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui { class FileSelectionWidget; }
|
||||
|
||||
class FileSelectionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged USER true)
|
||||
|
||||
public:
|
||||
enum class Mode {
|
||||
OpenFile, SaveFile, ExistingDirectory
|
||||
};
|
||||
|
||||
explicit FileSelectionWidget(QWidget *parent = nullptr);
|
||||
FileSelectionWidget(const Mode mode, QWidget *parent = nullptr);
|
||||
FileSelectionWidget(const Mode mode, const QString &path, QWidget *parent = nullptr);
|
||||
~FileSelectionWidget() override;
|
||||
|
||||
Mode mode() const;
|
||||
void setMode(const Mode mode);
|
||||
|
||||
QString path() const;
|
||||
void setPath(const QString &path);
|
||||
|
||||
signals:
|
||||
void pathChanged(const QString &path);
|
||||
|
||||
private slots:
|
||||
void selectPath();
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::FileSelectionWidget> m_ui;
|
||||
Mode m_mode;
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FileSelectionWidget</class>
|
||||
<widget class="QWidget" name="FileSelectionWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Select...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "ledindicator.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
LedIndicator::LedIndicator(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
setMinimumSize(16, 16);
|
||||
}
|
||||
|
||||
void LedIndicator::setColor(const QColor &color)
|
||||
{
|
||||
m_color = color;
|
||||
repaint();
|
||||
}
|
||||
|
||||
void LedIndicator::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
QRect ellipseRect;
|
||||
|
||||
if(width() < height())
|
||||
ellipseRect = QRect(0, height() / 2 - width() / 2, width(), width());
|
||||
else if(width() > height())
|
||||
ellipseRect = QRect(width() / 2 - height() / 2, 0, height(), height());
|
||||
else
|
||||
ellipseRect = rect();
|
||||
|
||||
ellipseRect.setWidth(ellipseRect.width() - 1);
|
||||
ellipseRect.setHeight(ellipseRect.height() - 1);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setPen(Qt::black);
|
||||
painter.setBrush(m_color);
|
||||
painter.drawEllipse(ellipseRect);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "dbguilib_global.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
class DBGUILIB_EXPORT LedIndicator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LedIndicator(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
void setColor(const QColor &color);
|
||||
|
||||
protected:
|
||||
// QWidget interface
|
||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QColor m_color;
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <QSpinBox>
|
||||
|
||||
template<int Tmin, int Tmax>
|
||||
class LimitedSpinBox : public QSpinBox
|
||||
{
|
||||
//No Q_OBJECT because template (not needed anyways)
|
||||
|
||||
public:
|
||||
LimitedSpinBox(QWidget *parent = Q_NULLPTR);
|
||||
};
|
||||
|
||||
template<int Tmin, int Tmax>
|
||||
LimitedSpinBox<Tmin, Tmax>::LimitedSpinBox(QWidget *parent) : QSpinBox(parent)
|
||||
{
|
||||
setRange(Tmin, Tmax);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "matrix4x4widget.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QVector4D>
|
||||
|
||||
Matrix4x4Widget::Matrix4x4Widget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
auto layout = new QGridLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_doubleSpinBox11 = new QDoubleSpinBox(this), 0, 0);
|
||||
layout->addWidget(m_doubleSpinBox12 = new QDoubleSpinBox(this), 0, 1);
|
||||
layout->addWidget(m_doubleSpinBox13 = new QDoubleSpinBox(this), 0, 2);
|
||||
layout->addWidget(m_doubleSpinBox14 = new QDoubleSpinBox(this), 0, 3);
|
||||
layout->addWidget(m_doubleSpinBox21 = new QDoubleSpinBox(this), 1, 0);
|
||||
layout->addWidget(m_doubleSpinBox22 = new QDoubleSpinBox(this), 1, 1);
|
||||
layout->addWidget(m_doubleSpinBox23 = new QDoubleSpinBox(this), 1, 2);
|
||||
layout->addWidget(m_doubleSpinBox24 = new QDoubleSpinBox(this), 1, 3);
|
||||
layout->addWidget(m_doubleSpinBox31 = new QDoubleSpinBox(this), 2, 0);
|
||||
layout->addWidget(m_doubleSpinBox32 = new QDoubleSpinBox(this), 2, 1);
|
||||
layout->addWidget(m_doubleSpinBox33 = new QDoubleSpinBox(this), 2, 2);
|
||||
layout->addWidget(m_doubleSpinBox34 = new QDoubleSpinBox(this), 2, 3);
|
||||
layout->addWidget(m_doubleSpinBox41 = new QDoubleSpinBox(this), 3, 0);
|
||||
layout->addWidget(m_doubleSpinBox42 = new QDoubleSpinBox(this), 3, 1);
|
||||
layout->addWidget(m_doubleSpinBox43 = new QDoubleSpinBox(this), 3, 2);
|
||||
layout->addWidget(m_doubleSpinBox44 = new QDoubleSpinBox(this), 3, 3);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
QMatrix4x4 Matrix4x4Widget::value() const
|
||||
{
|
||||
return QMatrix4x4(m_doubleSpinBox11->value(), m_doubleSpinBox12->value(), m_doubleSpinBox13->value(), m_doubleSpinBox14->value(),
|
||||
m_doubleSpinBox21->value(), m_doubleSpinBox22->value(), m_doubleSpinBox23->value(), m_doubleSpinBox24->value(),
|
||||
m_doubleSpinBox31->value(), m_doubleSpinBox32->value(), m_doubleSpinBox33->value(), m_doubleSpinBox34->value(),
|
||||
m_doubleSpinBox41->value(), m_doubleSpinBox42->value(), m_doubleSpinBox43->value(), m_doubleSpinBox44->value());
|
||||
}
|
||||
|
||||
void Matrix4x4Widget::setValue(const QMatrix4x4 &value)
|
||||
{
|
||||
{
|
||||
auto row = value.row(0);
|
||||
m_doubleSpinBox11->setValue(row.x());
|
||||
m_doubleSpinBox12->setValue(row.y());
|
||||
m_doubleSpinBox13->setValue(row.z());
|
||||
m_doubleSpinBox14->setValue(row.w());
|
||||
}
|
||||
{
|
||||
auto row = value.row(1);
|
||||
m_doubleSpinBox21->setValue(row.x());
|
||||
m_doubleSpinBox22->setValue(row.y());
|
||||
m_doubleSpinBox23->setValue(row.z());
|
||||
m_doubleSpinBox24->setValue(row.w());
|
||||
}
|
||||
{
|
||||
auto row = value.row(2);
|
||||
m_doubleSpinBox31->setValue(row.x());
|
||||
m_doubleSpinBox32->setValue(row.y());
|
||||
m_doubleSpinBox33->setValue(row.z());
|
||||
m_doubleSpinBox34->setValue(row.w());
|
||||
}
|
||||
{
|
||||
auto row = value.row(3);
|
||||
m_doubleSpinBox41->setValue(row.x());
|
||||
m_doubleSpinBox42->setValue(row.y());
|
||||
m_doubleSpinBox43->setValue(row.z());
|
||||
m_doubleSpinBox44->setValue(row.w());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "dbguilib_global.h"
|
||||
|
||||
#include <QMatrix4x4>
|
||||
|
||||
class QDoubleSpinBox;
|
||||
|
||||
class DBGUILIB_EXPORT Matrix4x4Widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QMatrix4x4 value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
|
||||
public:
|
||||
Matrix4x4Widget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
QMatrix4x4 value() const;
|
||||
void setValue(const QMatrix4x4 &value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(const QMatrix4x4 &value);
|
||||
|
||||
private:
|
||||
QDoubleSpinBox *m_doubleSpinBox11, *m_doubleSpinBox12, *m_doubleSpinBox13, *m_doubleSpinBox14;
|
||||
QDoubleSpinBox *m_doubleSpinBox21, *m_doubleSpinBox22, *m_doubleSpinBox23, *m_doubleSpinBox24;
|
||||
QDoubleSpinBox *m_doubleSpinBox31, *m_doubleSpinBox32, *m_doubleSpinBox33, *m_doubleSpinBox34;
|
||||
QDoubleSpinBox *m_doubleSpinBox41, *m_doubleSpinBox42, *m_doubleSpinBox43, *m_doubleSpinBox44;
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QStringListWidget</class>
|
||||
<widget class="QWidget" name="QStringListWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>452</width>
|
||||
<height>369</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonAdd">
|
||||
<property name="text">
|
||||
<string>Add entry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonDelete">
|
||||
<property name="text">
|
||||
<string>Delete entry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listView">
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::InternalMove</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "quaternionwidget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
QuaternionWidget::QuaternionWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_doubleSpinBoxX = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxY = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxZ = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxScalar = new QDoubleSpinBox(this));
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
QQuaternion QuaternionWidget::value() const
|
||||
{
|
||||
return QQuaternion(m_doubleSpinBoxX->value(), m_doubleSpinBoxY->value(), m_doubleSpinBoxZ->value(), m_doubleSpinBoxScalar->value());
|
||||
}
|
||||
|
||||
void QuaternionWidget::setValue(const QQuaternion &value)
|
||||
{
|
||||
m_doubleSpinBoxX->setValue(value.x());
|
||||
m_doubleSpinBoxY->setValue(value.y());
|
||||
m_doubleSpinBoxZ->setValue(value.z());
|
||||
m_doubleSpinBoxScalar->setValue(value.scalar());
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "dbguilib_global.h"
|
||||
|
||||
#include <QQuaternion>
|
||||
|
||||
class QDoubleSpinBox;
|
||||
|
||||
class DBGUILIB_EXPORT QuaternionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QQuaternion value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
|
||||
public:
|
||||
QuaternionWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
QQuaternion value() const;
|
||||
void setValue(const QQuaternion &value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(const QQuaternion &value);
|
||||
|
||||
private:
|
||||
QDoubleSpinBox *m_doubleSpinBoxX;
|
||||
QDoubleSpinBox *m_doubleSpinBoxY;
|
||||
QDoubleSpinBox *m_doubleSpinBoxZ;
|
||||
QDoubleSpinBox *m_doubleSpinBoxScalar;
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "stringlistwidget.h"
|
||||
#include "ui_qstringlistwidget.h"
|
||||
|
||||
#include <QStringListModel>
|
||||
|
||||
StringListWidget::StringListWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::QStringListWidget),
|
||||
m_model(new QStringListModel(this))
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
StringListWidget::StringListWidget(const QStringList &stringList, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::QStringListWidget),
|
||||
m_model(new QStringListModel(stringList, this))
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
StringListWidget::~StringListWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QStringList StringListWidget::value() const
|
||||
{
|
||||
return m_model->stringList();
|
||||
}
|
||||
|
||||
void StringListWidget::setValue(const QStringList &stringList)
|
||||
{
|
||||
m_model->setStringList(stringList);
|
||||
}
|
||||
|
||||
void StringListWidget::addPressed()
|
||||
{
|
||||
auto index = ui->listView->currentIndex();
|
||||
|
||||
m_model->insertRow(index.isValid() ? index.row() + 1: m_model->rowCount());
|
||||
}
|
||||
|
||||
void StringListWidget::deletePressed()
|
||||
{
|
||||
auto index = ui->listView->currentIndex();
|
||||
|
||||
if(!index.isValid())
|
||||
return;
|
||||
|
||||
m_model->removeRow(index.row());
|
||||
}
|
||||
|
||||
void StringListWidget::selectionChanged()
|
||||
{
|
||||
ui->pushButtonDelete->setEnabled(ui->listView->currentIndex().isValid());
|
||||
}
|
||||
|
||||
void StringListWidget::setup()
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->listView->setModel(m_model);
|
||||
|
||||
connect(ui->pushButtonAdd, &QAbstractButton::pressed, this, &StringListWidget::addPressed);
|
||||
connect(ui->pushButtonDelete, &QAbstractButton::pressed, this, &StringListWidget::deletePressed);
|
||||
connect(ui->listView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &StringListWidget::selectionChanged);
|
||||
|
||||
selectionChanged();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "dbguilib_global.h"
|
||||
|
||||
class QStringListModel;
|
||||
|
||||
namespace Ui { class QStringListWidget; }
|
||||
|
||||
class DBGUILIB_EXPORT StringListWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QStringList value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
|
||||
public:
|
||||
explicit StringListWidget(QWidget *parent = Q_NULLPTR);
|
||||
explicit StringListWidget(const QStringList &value, QWidget *parent = Q_NULLPTR);
|
||||
~StringListWidget();
|
||||
|
||||
QStringList value() const;
|
||||
void setValue(const QStringList &value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(const QStringList &value);
|
||||
|
||||
private Q_SLOTS:
|
||||
void addPressed();
|
||||
void deletePressed();
|
||||
void selectionChanged();
|
||||
|
||||
private:
|
||||
void setup();
|
||||
|
||||
Ui::QStringListWidget *ui;
|
||||
QStringListModel *m_model;
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "urlwidget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QToolButton>
|
||||
#include <QFileDialog>
|
||||
|
||||
UrlWidget::UrlWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_lineEdit = new QLineEdit(this));
|
||||
{
|
||||
auto toolButton = new QToolButton(this);
|
||||
connect(toolButton, &QAbstractButton::pressed, this, &UrlWidget::pressed);
|
||||
layout->addWidget(toolButton);
|
||||
}
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
QUrl UrlWidget::value() const
|
||||
{
|
||||
return QUrl(m_lineEdit->text());
|
||||
}
|
||||
|
||||
void UrlWidget::setValue(const QUrl &value)
|
||||
{
|
||||
m_lineEdit->setText(value.toString());
|
||||
}
|
||||
|
||||
void UrlWidget::pressed()
|
||||
{
|
||||
auto path = QFileDialog::getOpenFileName(this);
|
||||
if(!path.isEmpty())
|
||||
m_lineEdit->setText(path);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "dbguilib_global.h"
|
||||
|
||||
#include <QUrl>
|
||||
|
||||
class QLineEdit;
|
||||
|
||||
class DBGUILIB_EXPORT UrlWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QUrl value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
|
||||
public:
|
||||
UrlWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
QUrl value() const;
|
||||
void setValue(const QUrl &value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(const QUrl &value);
|
||||
|
||||
private Q_SLOTS:
|
||||
void pressed();
|
||||
|
||||
private:
|
||||
QLineEdit *m_lineEdit;
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "vector2dwidget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
Vector2DWidget::Vector2DWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_doubleSpinBoxX = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxY = new QDoubleSpinBox(this));
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
QVector2D Vector2DWidget::value() const
|
||||
{
|
||||
return QVector2D(m_doubleSpinBoxX->value(), m_doubleSpinBoxY->value());
|
||||
}
|
||||
|
||||
void Vector2DWidget::setValue(const QVector2D &value)
|
||||
{
|
||||
m_doubleSpinBoxX->setValue(value.x());
|
||||
m_doubleSpinBoxY->setValue(value.y());
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "dbguilib_global.h"
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
class QDoubleSpinBox;
|
||||
|
||||
class DBGUILIB_EXPORT Vector2DWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVector2D value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
|
||||
public:
|
||||
Vector2DWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
QVector2D value() const;
|
||||
void setValue(const QVector2D &value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(const QVector2D &value);
|
||||
|
||||
private:
|
||||
QDoubleSpinBox *m_doubleSpinBoxX;
|
||||
QDoubleSpinBox *m_doubleSpinBoxY;
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "vector3dwidget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
Vector3DWidget::Vector3DWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_doubleSpinBoxX = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxY = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxZ = new QDoubleSpinBox(this));
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
QVector3D Vector3DWidget::value() const
|
||||
{
|
||||
return QVector3D(m_doubleSpinBoxX->value(), m_doubleSpinBoxY->value(), m_doubleSpinBoxZ->value());
|
||||
}
|
||||
|
||||
void Vector3DWidget::setValue(const QVector3D &value)
|
||||
{
|
||||
m_doubleSpinBoxX->setValue(value.x());
|
||||
m_doubleSpinBoxY->setValue(value.y());
|
||||
m_doubleSpinBoxZ->setValue(value.z());
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "dbguilib_global.h"
|
||||
|
||||
#include <QVector3D>
|
||||
|
||||
class QDoubleSpinBox;
|
||||
|
||||
class DBGUILIB_EXPORT Vector3DWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVector3D value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
|
||||
public:
|
||||
Vector3DWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
QVector3D value() const;
|
||||
void setValue(const QVector3D &value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(const QVector3D &value);
|
||||
|
||||
private:
|
||||
QDoubleSpinBox *m_doubleSpinBoxX;
|
||||
QDoubleSpinBox *m_doubleSpinBoxY;
|
||||
QDoubleSpinBox *m_doubleSpinBoxZ;
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "vector4dwidget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
Vector4DWidget::Vector4DWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
auto layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_doubleSpinBoxX = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxY = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxZ = new QDoubleSpinBox(this));
|
||||
layout->addWidget(m_doubleSpinBoxW = new QDoubleSpinBox(this));
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
QVector4D Vector4DWidget::value() const
|
||||
{
|
||||
return QVector4D(m_doubleSpinBoxX->value(), m_doubleSpinBoxY->value(), m_doubleSpinBoxZ->value(), m_doubleSpinBoxW->value());
|
||||
}
|
||||
|
||||
void Vector4DWidget::setValue(const QVector4D &value)
|
||||
{
|
||||
m_doubleSpinBoxX->setValue(value.x());
|
||||
m_doubleSpinBoxY->setValue(value.y());
|
||||
m_doubleSpinBoxZ->setValue(value.z());
|
||||
m_doubleSpinBoxW->setValue(value.w());
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "dbguilib_global.h"
|
||||
|
||||
#include <QVector4D>
|
||||
|
||||
class QDoubleSpinBox;
|
||||
|
||||
class DBGUILIB_EXPORT Vector4DWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVector4D value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
|
||||
public:
|
||||
Vector4DWidget(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
QVector4D value() const;
|
||||
void setValue(const QVector4D &value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(const QVector4D &value);
|
||||
|
||||
private:
|
||||
QDoubleSpinBox *m_doubleSpinBoxX;
|
||||
QDoubleSpinBox *m_doubleSpinBoxY;
|
||||
QDoubleSpinBox *m_doubleSpinBoxZ;
|
||||
QDoubleSpinBox *m_doubleSpinBoxW;
|
||||
};
|
||||
Reference in new issue
Block a user