opt:qtsingleapplication remove old code

This commit is contained in:
xiaoyifang 2023-04-29 00:45:03 +08:00
parent dbe04db7f5
commit 7f6409c05a
3 changed files with 8 additions and 42 deletions

View file

@ -16,10 +16,7 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
QHotkeyApplication::QHotkeyApplication( int & argc, char ** argv ): QHotkeyApplication::QHotkeyApplication( int & argc, char ** argv ):
QIntermediateApplication( argc, argv ) QtSingleApplication( argc, argv )
#ifdef Q_OS_WIN32
, mainWindow( 0 )
#endif
{ {
connect( this, connect( this,
&QGuiApplication::commitDataRequest, &QGuiApplication::commitDataRequest,
@ -40,10 +37,7 @@ QHotkeyApplication::QHotkeyApplication( int & argc, char ** argv ):
QHotkeyApplication::QHotkeyApplication( QString const & id, QHotkeyApplication::QHotkeyApplication( QString const & id,
int & argc, char ** argv ): int & argc, char ** argv ):
QIntermediateApplication( id, argc, argv ) QtSingleApplication( id, argc, argv )
#ifdef Q_OS_WIN32
, mainWindow( 0 )
#endif
{ {
connect( this, connect( this,
&QGuiApplication::commitDataRequest, &QGuiApplication::commitDataRequest,

View file

@ -206,25 +206,10 @@ public:
{} {}
}; };
// Intermediate class to avoid misunderstanding of #ifdef's class QHotkeyApplication: public QtSingleApplication
// by Qt meta-object compiler
class QIntermediateApplication : public QtSingleApplication
#if defined( Q_OS_WIN ) #if defined( Q_OS_WIN )
,public QAbstractNativeEventFilter ,public QAbstractNativeEventFilter
#endif #endif
{
public:
QIntermediateApplication( int & argc, char ** argv ) :
QtSingleApplication( argc, argv )
{}
QIntermediateApplication( QString const & id, int & argc, char ** argv ) :
QtSingleApplication( id, argc, argv )
{}
};
class QHotkeyApplication : public QIntermediateApplication
{ {
Q_OBJECT Q_OBJECT
@ -257,11 +242,6 @@ protected:
virtual bool nativeEventFilter( const QByteArray & eventType, void * message, qintptr * result ); virtual bool nativeEventFilter( const QByteArray & eventType, void * message, qintptr * result );
#endif #endif
QWidget * mainWindow;
public:
void setMainWindow( QWidget * widget )
{ mainWindow = widget; }
protected: protected:
#endif // Q_OS_WIN32 #endif // Q_OS_WIN32
QList<HotkeyWrapper*> hotkeyWrappers; QList<HotkeyWrapper*> hotkeyWrappers;

View file

@ -68,14 +68,6 @@ class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication
public: public:
QtSingleApplication(int &argc, char **argv, bool GUIenabled = true); QtSingleApplication(int &argc, char **argv, bool GUIenabled = true);
QtSingleApplication(const QString &id, int &argc, char **argv); QtSingleApplication(const QString &id, int &argc, char **argv);
#if QT_VERSION < 0x050000
QtSingleApplication(int &argc, char **argv, Type type);
# if defined(HAVE_X11)
QtSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
QtSingleApplication(Display* dpy, const QString &appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
# endif // HAVE_X11
#endif // QT_VERSION < 0x050000
bool isRunning(); bool isRunning();
QString id() const; QString id() const;