改进代码
This commit is contained in:
@@ -3,7 +3,12 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#ifdef quc
|
||||
class Q_DECL_EXPORT FramelessDialog : public QDialog
|
||||
#else
|
||||
class FramelessDialog : public QDialog
|
||||
#endif
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#ifdef quc
|
||||
class Q_DECL_EXPORT FramelessMainWindow : public QMainWindow
|
||||
#else
|
||||
class FramelessMainWindow : public QMainWindow
|
||||
#endif
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef quc
|
||||
class Q_DECL_EXPORT FramelessWidget : public QWidget
|
||||
#else
|
||||
class FramelessWidget : public QWidget
|
||||
#endif
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include "qpushbutton.h"
|
||||
#include "qcheckbox.h"
|
||||
#include "framelesswidget2.h"
|
||||
#include "framelessform/dialog.h"
|
||||
#include "framelessform/widget.h"
|
||||
#include "framelessform/mainwindow.h"
|
||||
|
||||
frmFramelessWidget::frmFramelessWidget(QWidget *parent) : QWidget(parent), ui(new Ui::frmFramelessWidget)
|
||||
{
|
||||
@@ -80,3 +83,24 @@ void frmFramelessWidget::stateChanged2(int arg1)
|
||||
frameless->setResizeEnable(arg1 != 0);
|
||||
}
|
||||
}
|
||||
|
||||
void frmFramelessWidget::on_btnDialog_clicked()
|
||||
{
|
||||
Dialog dialog;
|
||||
dialog.resize(800, 600);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void frmFramelessWidget::on_btnWidget_clicked()
|
||||
{
|
||||
Widget *widget = new Widget;
|
||||
widget->resize(800, 600);
|
||||
widget->show();
|
||||
}
|
||||
|
||||
void frmFramelessWidget::on_btnMainWindow_clicked()
|
||||
{
|
||||
MainWindow *window = new MainWindow;
|
||||
window->resize(800, 600);
|
||||
window->show();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ private slots:
|
||||
void on_pushButton_clicked();
|
||||
void stateChanged1(int arg1);
|
||||
void stateChanged2(int arg1);
|
||||
|
||||
void on_btnDialog_clicked();
|
||||
void on_btnWidget_clicked();
|
||||
void on_btnMainWindow_clicked();
|
||||
};
|
||||
|
||||
#endif // FRMFRAMELESSWIDGET_H
|
||||
|
||||
@@ -13,18 +13,45 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>92</width>
|
||||
<height>28</height>
|
||||
<width>491</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>弹出</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>弹出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnDialog">
|
||||
<property name="text">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnWidget">
|
||||
<property name="text">
|
||||
<string>Widget</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnMainWindow">
|
||||
<property name="text">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
#include "frmframelesswidget.h"
|
||||
#include "dialog.h"
|
||||
#include "widget.h"
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
|
||||
@@ -29,11 +26,8 @@ int main(int argc, char *argv[])
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
#endif
|
||||
|
||||
frmFramelessWidget w;
|
||||
//Dialog w;
|
||||
//Widget w;
|
||||
//MainWindow w;
|
||||
w.setWindowTitle("无边框窗体类");
|
||||
frmFramelessWidget w;
|
||||
w.setWindowTitle("无边框窗体");
|
||||
w.resize(800, 600);
|
||||
w.show();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user