Hello MrDeath,
The code below causes the problem:
main.cpp:
#include <QApplication>
#include "user_interface.h"
int _tmain(int argc, char* argv[])
{
UserInterface* gui = new UserInterface();
gui->show();
return a.exec();
}
#include <QApplication>
#include "user_interface.h"
int _tmain(int argc, char* argv[])
{
QApplication a(argc, argv);
UserInterface* gui = new UserInterface();
gui->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
user_interface.h:
#include <QDialog>
#include <QMenu>
#include <QMouseEvent>
#include <QPushButton>
class UserInterface
: public QDialog{
Q_OBJECT
public:
{
resize(400, 300);
move(0, 0);
setWindowState(0);
context_menu
= new QMenu(this);
context_menu->setContextMenuPolicy( Qt::NoContextMenu );
context_menu->addAction("Maximize",
this,
SLOT(menu_maximized()), 0 );
context_menu->addAction("Full screen",
this,
SLOT(menu_fullscreen()),0 );
context_menu->addAction("Free",
this,
SLOT(menu_free()), 0 );
finish_button
= new QPushButton(this);
//comment this out and everything works fine!
}
private:
{
if( e->button() == Qt::RightButton )
{ context_menu->popup(e->globalPos());
}
}
private slots:
void menu_maximized()
{
setWindowState(Qt::WindowMaximized);
}
void menu_free()
{
setWindowState(Qt::WindowNoState);
}
void menu_fullscreen()
{
setWindowState(Qt::WindowFullScreen);
}
};
#include <QDialog>
#include <QMenu>
#include <QMouseEvent>
#include <QPushButton>
class UserInterface : public QDialog
{
Q_OBJECT
public:
UserInterface(QWidget* parent = 0) : QDialog(parent)
{
resize(400, 300);
move(0, 0);
setWindowState(0);
context_menu = new QMenu(this);
context_menu->setContextMenuPolicy( Qt::NoContextMenu );
context_menu->addAction("Maximize",
this,
SLOT(menu_maximized()), 0 );
context_menu->addAction("Full screen",
this,
SLOT(menu_fullscreen()),0 );
context_menu->addAction("Free",
this,
SLOT(menu_free()), 0 );
finish_button = new QPushButton(this); //comment this out and everything works fine!
}
private:
QMenu* context_menu;
QPushButton* finish_button;
void mousePressEvent(QMouseEvent *e)
{
if( e->button() == Qt::RightButton )
{ context_menu->popup(e->globalPos());
}
}
private slots:
void menu_maximized()
{
setWindowState(Qt::WindowMaximized);
}
void menu_free()
{
setWindowState(Qt::WindowNoState);
}
void menu_fullscreen()
{
setWindowState(Qt::WindowFullScreen);
}
};
To copy to clipboard, switch view to plain text mode
As you can see its very simple, I dont know what could be causing it.
It works fine until the window state changes (using the context menu) then the problems arise, until then I can bring up and close the menu and use the button OK.
I should mention i've built Qt specifically for my CE device, although the only difference between mine and the standard is that I built it with QT_FORCE_CREATE_GUID.
Edit: update - I've been working on the program as far as possible (without buttons) and I am also receiveing a stack overflow error when using the static method getText() of QInputDialog.
Bookmarks