Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, August 2007
std::cout in windows won't compile with "config += console"


Message 1 in thread

i added "CONFIG += CONSOLE" to the .pro file.
however, i ended up with an error message

g++ -enable-stdcall-fixup -Wl,-enable-auto-import 
-Wl,-enable-runtime-pseudo-rel
oc -Wl,-s -Wl,-subsystem,console -mthreads -Wl -o "release\doba8.exe" 
release\ma
in.o release\myqtapp.o release\moc_myqtapp.o  -L"c:\Qt\4.3.0\lib" 
-lQtGui4 -lQtC
ore4
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined 
reference to `Wi
nMain@16'
collect2: ld returned 1 exit status

otherwise, it works :)

--
 [ signature omitted ] 

Message 2 in thread

I'm trying to use the QWizard class introduced in Qt4.3.0 but whenever I
try to create my QWizard derived class in a slot, I get an access
violation deep in the Qt library:

qwizard_win.cpp
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
{
    bool status = false;
    if (wizard->wizardStyle() == QWizard::AeroStyle) {
        status = winEvent(message, result);
        if (message->message == WM_NCCALCSIZE) {
            if (status)
                collapseTopFrameStrut();
        } else if (message->message == WM_NCPAINT) {
            wizard->update();
        }
    }
    return status;
}
It appears as if the wizard pointer is no longer valid. Here is my
calling code:

void MyApp::testSlot()
{
NewProjectWizard* projwizard = new NewProjectWizard( this );
projwizard->show();
}

This code works fine anywhere but in a connected slot. Has anyone else
experienced this? Could someone else test this and see if I'm crazy? I
have Qt 4.3.0 compiled for Microsft Visual Studio 2005 installed and I'm
running Windows XP, not Vista. Maybe Qt4.3.1 fixes this problem but I
didn't see anything in the change log. Any help would be appreciated,
thanks.

THE INFORMATION CONTAINED IN THIS E-MAIL MESSAGE AND ANY ATTACHMENTS SENT FROM GENTEX CORPORATION IS GENTEX CONFIDENTIAL INFORMATION INTENDED ONLY FOR THE PERSONAL USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. If you are not the intended recipient, you are hereby notified that any review, distribution, or copying of this communication is strictly prohibited.  If you have received this communication in error, please immediately notify the sender by return e-mail, and delete this e-mail message and any attachments from your computer.  


--
 [ signature omitted ] 

Message 3 in thread

It looks like it's not just with any connected slot, but only slots
connected to widgets on a toolbar or to QActions signals.

Here is the minimally compilable source code that will recreate the
problem:

//main.cpp
#include <QtGui/QApplication>
#include "example.h"
int main(int argc, char *argv[])
{

    QApplication a(argc, argv);
    example w;
    w.show();
    a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
    return a.exec();

}

//example.h
#include <QtGui/QMainWindow>
#include <QAction>
#include <QToolBar>
class example: public QMainWindow
{
    Q_OBJECT

public:

    example( QWidget *parent = 0, Qt::WFlags flags = 0 );

public slots:

    void TestSlot();

private:

    QToolBar *mainToolBar;
};

//Example.cpp
#include "example.h"
#include <QWizard>
#include <QToolButton>
example::example(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
    mainToolBar = new QToolBar( this );

    QToolButton* tstButton = new QToolButton;
    tstButton->setText( "Test" );
    mainToolBar->addWidget( tstButton );

    connect( tstButton, SIGNAL( clicked() ), this, SLOT( TestSlot() ) );
}

void example::TestSlot()
{
    QWizard* myWizard = new QWizard( this );
    myWizard->show();
}

-----Original Message-----
From: Lareau, Joshua [mailto:joshua.lareau@xxxxxxxxxx] 
Sent: Wednesday, August 15, 2007 10:41 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: QWizard crashes when created in a slot

I'm trying to use the QWizard class introduced in Qt4.3.0 but whenever I
try to create my QWizard derived class in a slot, I get an access
violation deep in the Qt library:

qwizard_win.cpp
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
{
    bool status = false;
    if (wizard->wizardStyle() == QWizard::AeroStyle) {
        status = winEvent(message, result);
        if (message->message == WM_NCCALCSIZE) {
            if (status)
                collapseTopFrameStrut();
        } else if (message->message == WM_NCPAINT) {
            wizard->update();
        }
    }
    return status;
}
It appears as if the wizard pointer is no longer valid. Here is my
calling code:

void MyApp::testSlot()
{
NewProjectWizard* projwizard = new NewProjectWizard( this );
projwizard->show();
}

This code works fine anywhere but in a connected slot. Has anyone else
experienced this? Could someone else test this and see if I'm crazy? I
have Qt 4.3.0 compiled for Microsft Visual Studio 2005 installed and I'm
running Windows XP, not Vista. Maybe Qt4.3.1 fixes this problem but I
didn't see anything in the change log. Any help would be appreciated,
thanks.

THE INFORMATION CONTAINED IN THIS E-MAIL MESSAGE AND ANY ATTACHMENTS
SENT FROM GENTEX CORPORATION IS GENTEX CONFIDENTIAL INFORMATION INTENDED
ONLY FOR THE PERSONAL USE OF THE INDIVIDUAL OR ENTITY NAMED ABOVE. If
you are not the intended recipient, you are hereby notified that any
review, distribution, or copying of this communication is strictly
prohibited.  If you have received this communication in error, please
immediately notify the sender by return e-mail, and delete this e-mail
message and any attachments from your computer.  




--
 [ signature omitted ] 

Message 4 in thread

On 8/15/07, Lareau, Joshua <joshua.lareau@xxxxxxxxxx> wrote:
> It looks like it's not just with any connected slot, but only slots
> connected to widgets on a toolbar or to QActions signals.
>
> Here is the minimally compilable source code that will recreate the
> problem:

Send it to qt-bugs (at) trolltech (dot) com.

-- 
 [ signature omitted ]