1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

exauisite if use dialog on android is a dialog, little dialog

This commit is contained in:
tianduanrui 2017-10-29 15:18:40 +08:00
parent fc0b62f09c
commit 061aeaef06
6 changed files with 204 additions and 191 deletions

View File

@ -59,10 +59,10 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
main.cpp \
qqtexquisiteform.cpp
mainwindow.cpp
HEADERS += \
qqtexquisiteform.h
mainwindow.h
FORMS += \
qqtexquisiteform.ui
mainwindow.ui

View File

@ -1,10 +1,10 @@
#include "qqtexquisiteform.h"
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
QQtExquisiteForm w;
MainWindow w;
w.show();
return a.exec();

View File

@ -1,13 +1,12 @@
#include "qqtexquisiteform.h"
#include "ui_qqtexquisiteform.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMouseEvent>
#include <QKeyEvent>
#include <qqtcore.h>
QQtExquisiteForm::QQtExquisiteForm(QWidget* parent) :
QDialog(parent),
ui(new Ui::QQtExquisiteForm)
MainWindow::MainWindow(QWidget* parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
@ -161,17 +160,17 @@ QQtExquisiteForm::QQtExquisiteForm(QWidget* parent) :
m_timer_down->start(10);
}
QQtExquisiteForm::~QQtExquisiteForm()
MainWindow::~MainWindow()
{
delete ui;
}
void QQtExquisiteForm::setValue(int value)
void MainWindow::setValue(int value)
{
this->value = value;
}
void QQtExquisiteForm::setValue()
void MainWindow::setValue()
{
//pline() << value;
if (value > curmaxValue)
@ -183,7 +182,7 @@ void QQtExquisiteForm::setValue()
ui->hs0->setValue(value);
}
void QQtExquisiteForm::setValueDown()
void MainWindow::setValueDown()
{
if (value > 0)
value--;
@ -191,7 +190,7 @@ void QQtExquisiteForm::setValueDown()
}
void QQtExquisiteForm::keyPressEvent(QKeyEvent* event)
void MainWindow::keyPressEvent(QKeyEvent* event)
{
//pline() << hex << event->key();
if (event->key() == Qt::Key_Up)
@ -201,11 +200,11 @@ void QQtExquisiteForm::keyPressEvent(QKeyEvent* event)
event->accept();
}
QDialog::keyPressEvent(event);
QMainWindow::keyPressEvent(event);
}
void QQtExquisiteForm::keyReleaseEvent(QKeyEvent* event)
void MainWindow::keyReleaseEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Up)
{
@ -213,10 +212,10 @@ void QQtExquisiteForm::keyReleaseEvent(QKeyEvent* event)
m_timer->stop();
event->accept();
}
QDialog::keyReleaseEvent(event);
QMainWindow::keyReleaseEvent(event);
}
bool QQtExquisiteForm::eventFilter(QObject* watched, QEvent* event)
bool MainWindow::eventFilter(QObject* watched, QEvent* event)
{
if (event->type() != QEvent::Paint)
;//pline() << watched << hex << event->type();
@ -275,10 +274,10 @@ bool QQtExquisiteForm::eventFilter(QObject* watched, QEvent* event)
/*fix the parent handled bug terminally*/
if (event->type() == QEvent::Paint)
{
return QDialog::eventFilter(watched, event);
return QMainWindow::eventFilter(watched, event);
}
//+ fix bug
return true;
}
return QDialog::eventFilter(watched, event);
return QMainWindow::eventFilter(watched, event);
}

View File

@ -1,28 +1,27 @@
#ifndef QQTEXQUISITEFORM_H
#define QQTEXQUISITEFORM_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QDialog>
#include <QMainWindow>
#include <QTimer>
namespace Ui
{
class QQtExquisiteForm;
class MainWindow;
}
class QQtExquisiteForm : public QDialog
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit QQtExquisiteForm(QWidget* parent = 0);
~QQtExquisiteForm();
explicit MainWindow(QWidget* parent = 0);
~MainWindow();
private slots:
void setValue(int);
void setValue();
void setValueDown();
private:
Ui::QQtExquisiteForm* ui;
QTimer* m_timer ;
QTimer* m_timer_down ;
int value;
@ -36,6 +35,9 @@ protected:
// QObject interface
public:
virtual bool eventFilter(QObject* watched, QEvent* event) override;
private:
Ui::MainWindow* ui;
};
#endif // QQTEXQUISITEFORM_H
#endif // MAINWINDOW_H

View File

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1002</width>
<height>629</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tab 1</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QQtCustomEffectProgressBar" name="w01" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w0" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w1" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w2" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 2</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QQtCustomEffectProgressBar" name="w5" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w6" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w3" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w4" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>页</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QQtCustomEffectProgressBar" name="w50" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w51" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w52" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w53" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>页</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QQtCustomEffectProgressBar" name="w40" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w41" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w42" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w43" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>页</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QQtCustomSpeedMeter" name="w7" native="true"/>
</item>
<item>
<widget class="QQtCustomSpeedMeter" name="w8" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>页</string>
</attribute>
<widget class="QQTProgressBar" name="w60" native="true">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>491</width>
<height>41</height>
</rect>
</property>
</widget>
</widget>
</widget>
</item>
<item>
<widget class="QSlider" name="hs0">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1002</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>QQtCustomSpeedMeter</class>
<extends>QWidget</extends>
<header location="global">qqtcustomspeedmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QQtCustomEffectProgressBar</class>
<extends>QWidget</extends>
<header location="global">qqtcustomeffectprogressbar.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QQTProgressBar</class>
<extends>QWidget</extends>
<header location="global">qqtprogressbar.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,160 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QQtExquisiteForm</class>
<widget class="QDialog" name="QQtExquisiteForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>739</width>
<height>515</height>
</rect>
</property>
<property name="windowTitle">
<string>QQtExquisiteForm</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tab 1</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QQtCustomEffectProgressBar" name="w01" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w0" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w1" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w2" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 2</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QQtCustomEffectProgressBar" name="w5" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w6" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w3" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w4" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>页</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QQtCustomEffectProgressBar" name="w50" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w51" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w52" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w53" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>页</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QQtCustomEffectProgressBar" name="w40" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w41" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w42" native="true"/>
</item>
<item>
<widget class="QQtCustomEffectProgressBar" name="w43" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>页</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QQtCustomSpeedMeter" name="w7" native="true"/>
</item>
<item>
<widget class="QQtCustomSpeedMeter" name="w8" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>页</string>
</attribute>
<widget class="QQTProgressBar" name="w60" native="true">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>491</width>
<height>41</height>
</rect>
</property>
</widget>
</widget>
</widget>
</item>
<item>
<widget class="QSlider" name="hs0">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QQtCustomSpeedMeter</class>
<extends>QWidget</extends>
<header location="global">qqtcustomspeedmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QQtCustomEffectProgressBar</class>
<extends>QWidget</extends>
<header location="global">qqtcustomeffectprogressbar.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QQTProgressBar</class>
<extends>QWidget</extends>
<header location="global">qqtprogressbar.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>