mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
refactor: convert scanflag.ui to plain code
This commit is contained in:
parent
a7c1589149
commit
38956589a2
|
@ -147,7 +147,6 @@ set(UI_SRC
|
|||
options.ui
|
||||
orderandprops.ui
|
||||
preferences.ui
|
||||
scanflag.ui
|
||||
scanpopup.ui
|
||||
sources.ui
|
||||
)
|
||||
|
|
|
@ -568,7 +568,6 @@ mac {
|
|||
|
||||
unix:!mac {
|
||||
HEADERS += scanflag.hh
|
||||
FORMS += scanflag.ui
|
||||
SOURCES += scanflag.cc
|
||||
}
|
||||
|
||||
|
|
28
scanflag.cc
28
scanflag.cc
|
@ -1,37 +1,37 @@
|
|||
#include <QCursor>
|
||||
|
||||
#include "scanflag.hh"
|
||||
#include "ui_scanflag.h"
|
||||
#include <QCursor>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
|
||||
|
||||
ScanFlag::ScanFlag(QWidget *parent) :
|
||||
QMainWindow(parent)
|
||||
QMainWindow(parent),
|
||||
pushButton(new QPushButton(this))
|
||||
{
|
||||
ui.setupUi( this );
|
||||
|
||||
pushButton->setIcon(QIcon(":/icons/programicon.png"));
|
||||
|
||||
setCentralWidget(pushButton);
|
||||
|
||||
setFixedSize(30,30);
|
||||
|
||||
setWindowFlags( Qt::ToolTip
|
||||
| Qt::FramelessWindowHint
|
||||
| Qt::WindowStaysOnTopHint
|
||||
| Qt::WindowDoesNotAcceptFocus);
|
||||
|
||||
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setAttribute(Qt::WA_X11DoNotAcceptFocus);
|
||||
|
||||
hideTimer.setSingleShot( true );
|
||||
hideTimer.setInterval( 1000 );
|
||||
|
||||
connect( &hideTimer, &QTimer::timeout,
|
||||
this, [=]{ hideWindow();
|
||||
});
|
||||
|
||||
connect( ui.pushButton, &QPushButton::clicked,
|
||||
connect( &hideTimer, &QTimer::timeout,this,&ScanFlag::hideWindow);
|
||||
connect( pushButton, &QPushButton::clicked,
|
||||
this, &ScanFlag::pushButtonClicked );
|
||||
}
|
||||
|
||||
ScanFlag::~ScanFlag()
|
||||
{
|
||||
}
|
||||
|
||||
void ScanFlag::pushButtonClicked()
|
||||
{
|
||||
hideTimer.stop();
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#ifndef SCAN_FLAG_H
|
||||
#define SCAN_FLAG_H
|
||||
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
#include "ui_scanflag.h"
|
||||
|
||||
class ScanFlag : public QMainWindow
|
||||
{
|
||||
|
@ -13,7 +12,7 @@ class ScanFlag : public QMainWindow
|
|||
public:
|
||||
ScanFlag( QWidget *parent );
|
||||
|
||||
~ScanFlag();
|
||||
~ScanFlag()=default;
|
||||
|
||||
void showScanFlag();
|
||||
void pushButtonClicked();
|
||||
|
@ -23,9 +22,8 @@ signals:
|
|||
void requestScanPopup ();
|
||||
|
||||
private:
|
||||
Ui::ScanFlag ui;
|
||||
QTimer hideTimer;
|
||||
|
||||
QPushButton * pushButton;
|
||||
};
|
||||
|
||||
#endif // SCAN_FLAG_H
|
||||
|
|
38
scanflag.ui
38
scanflag.ui
|
@ -1,38 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScanFlag</class>
|
||||
<widget class="QMainWindow" name="ScanFlag">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/icons/programicon.png</normaloff>:/icons/programicon.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue