guys please figure out this...I am still having problem
my code are as follows::
main.cpp
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
MainWindow w;
w.show();
a.installEventFilter(&w);
return a.exec();
}
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
a.installEventFilter(&w);
return a.exec();
}
To copy to clipboard, switch view to plain text mode
and my mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QDebug"
#include "qdebug.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->label->installEventFilter(this);
}
{
if (e
->type
()==QEvent::MouseButtonPress && obj
== ui
->label
) {
qDebug("User clicked on label");
}
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QDebug"
#include "qdebug.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->label->installEventFilter(this);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *e)
{
if (e->type()==QEvent::MouseButtonPress && obj == ui->label)
{
qDebug("User clicked on label");
}
return QMainWindow::eventFilter(obj, e);
}
MainWindow::~MainWindow()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
and mainwindow class
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
bool eventFilter(QObject *obj, QEvent *e);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
ERROR::cannot open output file ..exe
Bookmarks