Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt error: `qApp' was not declared in this scope

Tags:

c++

qt

As I know qApp is global pointer so it should be accessible anywhere but I am getting this error error: qApp was not declared in this scope.

  1 #include "textEdit.h"
  2
  3 TextEdit::TextEdit() {
  4 }
  5
  6 void TextEdit::insertFromMimeData (const QMimeData * source) {
  7     if (qApp->mouseButtons() == Qt::MidButton) {
  8         return;
  9     }
 10     QTextEdit::insertFromMimeData(source);
 11 }
 12
 13
like image 569
Ashot Avatar asked Jul 23 '13 15:07

Ashot


1 Answers

You need to use

#include <QApplication>

to use the qApp macro. See documentation at http://doc.qt.io/qt-5/qapplication.html#qApp

like image 107
Muckle_ewe Avatar answered Nov 03 '22 01:11

Muckle_ewe