View previous topic :: View next topic |
Author |
Message |
mweber1488
Joined: 10 Jun 2008 Posts: 15
|
Posted: Fri Feb 04, 2011 8:48 am Post subject: Qtd Painter Error |
|
|
I set up some test code to see if I built Qtd properly. Whenever I mouse over the quit button I get the following error:
Code: | QPaintDevice: Cannot destroy paint device that is being painted
object.Error: Access Violation | And here is the code that I am using: Code: | import qt.gui.QApplication;
import qt.gui.QMainWindow;
import qt.gui.QWidget;
import qt.gui.QLabel;
import qt.gui.QPushButton;
import qt.gui.QVBoxLayout;
int main(string[] args)
{
scope App = new QApplication(args);
scope label = new QLabel(tr("Hello, World!"));
scope quit = new QPushButton(tr("&Quit"));
scope widget = new QWidget;
widget.setLayout(new QVBoxLayout);
widget.layout.addWidget(label);
widget.layout.addWidget(quit);
scope window = new QMainWindow;
window.setWindowTitle(tr("Hello"));
window.setCentralWidget(widget);
QObject.connect(quit, "clicked", window, "close");
window.show();
return App.exec();
} |
|
|
Back to top |
|
|
arni
Joined: 24 Jan 2011 Posts: 5
|
Posted: Mon Feb 07, 2011 12:56 pm Post subject: |
|
|
Looks like some paint message is being sent to a destroyed windows.
Shouldn't you call the app's quit slot instead? |
|
Back to top |
|
|
arni
Joined: 24 Jan 2011 Posts: 5
|
Posted: Mon Feb 07, 2011 12:57 pm Post subject: |
|
|
Looks like some paint message is being sent to a destroyed windows.
Shouldn't you call the app's quit slot instead? |
|
Back to top |
|
|
mweber1488
Joined: 10 Jun 2008 Posts: 15
|
Posted: Mon Feb 07, 2011 2:47 pm Post subject: |
|
|
I always do close in case I want to do something before the window is destroyed but I doesn't matter as the error triggers when the tip of the mouse hovers over the button, not when it is clicked. |
|
Back to top |
|
|
Destructionator
Joined: 17 Sep 2007 Posts: 9 Location: New York State
|
Posted: Sat Feb 12, 2011 6:03 pm Post subject: |
|
|
I see this in my app too, but only on Windows.
I think it might have something to do with the Layouts. Simple examples without layouts work fine but using a layout like your code or my code seems to crash. |
|
Back to top |
|
|
Destructionator
Joined: 17 Sep 2007 Posts: 9 Location: New York State
|
Posted: Sat Feb 12, 2011 6:56 pm Post subject: |
|
|
FYI, my app seems to work if I use "-style cde" on the command line, so there are no mouse over effects.
Kinda sucks, but at least we've got something to work with. |
|
Back to top |
|
|
mweber1488
Joined: 10 Jun 2008 Posts: 15
|
Posted: Mon Feb 14, 2011 7:43 am Post subject: |
|
|
It works but definitely not ideal. |
|
Back to top |
|
|
Destructionator
Joined: 17 Sep 2007 Posts: 9 Location: New York State
|
Posted: Mon Feb 14, 2011 8:41 am Post subject: |
|
|
Yeah. I'm afraid I had to give up on QtD at this point. It worked so well on Linux, but even with the -style hack, it still had some random crashes on Windows as I used the app.
I ultimately decided to write a small dll in C++ that handles the GUI, and the main app is in D. They pass messages over a handful of simple C style functions. |
|
Back to top |
|
|
mweber1488
Joined: 10 Jun 2008 Posts: 15
|
Posted: Tue Mar 01, 2011 3:20 pm Post subject: |
|
|
How do you compile the c++ code? I have been unable to get it to work. |
|
Back to top |
|
|
michaelc97
Joined: 06 May 2007 Posts: 9
|
Posted: Sat Sep 21, 2013 10:58 am Post subject: |
|
|
i got this to work on windows 7 by compiling with -mstackrealign option e.g.
cmake -G"MinGW Makefiles" -DCMAKE_CXX_FLAGS=-m32 -fpermissive -mstackrealign" ../ |
|
Back to top |
|
|
|