添加参数界面
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
#include "Index1.h"
|
||||
#include "ui_Index1.h"
|
||||
|
||||
Index1::Index1(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::Index1)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
//load qss
|
||||
QFile file(":/qss/Setting.qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
QTextStream filetext(&file);
|
||||
QString stylesheet = filetext.readAll();
|
||||
this->setStyleSheet(stylesheet);
|
||||
file.close();
|
||||
|
||||
connect(this,SIGNAL(IndexChanged(int)),
|
||||
this,SLOT(onTabIndexChanged(int)));
|
||||
|
||||
emit IndexChanged(0);
|
||||
}
|
||||
|
||||
Index1::~Index1()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Index1::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
if(paramInspector)
|
||||
{
|
||||
paramInspector->setGeometry(ui->frame->geometry());
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void Index1::onTabIndexChanged(const int &index)//界面选择管理
|
||||
{
|
||||
//参数设置
|
||||
if(index == 0)
|
||||
{
|
||||
if(paramInspector)
|
||||
paramInspector->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(paramInspector)
|
||||
paramInspector->hide();
|
||||
}
|
||||
|
||||
//地图设置
|
||||
//if(index == 1) paramInspector->show();
|
||||
//else paramInspector->hide();
|
||||
}
|
||||
|
||||
|
||||
void Index1::on_pushButton_Parameters_clicked()
|
||||
{
|
||||
emit IndexChanged(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Index1::setParamWidget(QWidget *w)
|
||||
{
|
||||
|
||||
paramInspector = w;
|
||||
paramInspector->setParent(this);
|
||||
qDebug() << w << paramInspector;
|
||||
|
||||
if(paramInspector)
|
||||
{
|
||||
qDebug() << "install param inspector";
|
||||
paramInspector->setGeometry(0,0,ui->frame->width(),ui->frame->height());
|
||||
paramInspector->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef INDEX1_H
|
||||
#define INDEX1_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "QFile"
|
||||
#include "QTextStream"
|
||||
#include "QDebug"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class Index1;
|
||||
}
|
||||
|
||||
class Index1 : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Index1(QWidget *parent = nullptr);
|
||||
~Index1();
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
Ui::Index1 *ui;
|
||||
|
||||
|
||||
|
||||
QWidget *paramInspector = nullptr;
|
||||
private slots:
|
||||
|
||||
void onTabIndexChanged(const int &index);
|
||||
|
||||
|
||||
void on_pushButton_Parameters_clicked();
|
||||
|
||||
signals:
|
||||
void IndexChanged(const int &index);
|
||||
|
||||
public slots:
|
||||
|
||||
void setParamWidget(QWidget *w);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // INDEX1_H
|
||||
@@ -0,0 +1,24 @@
|
||||
FORMS += \
|
||||
$$PWD/Index1.ui
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/Index1.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/Index1.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Index1</class>
|
||||
<widget class="QWidget" name="Index1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>622</width>
|
||||
<height>342</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_Parameters">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>param</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Nop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<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>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user