qt3 to qt4 conversion: no toolbar buttons
Hi,
I am converting a large app. to Qt4 that was built 5 years ago for the then current Qt and since converted to Qt3.
It shows my ignorance, but one of several problems is that the toolbar buttons don't show up under Qt4.
I have uploaded the relevant pieces to http://www.esnips.com/web/gpc-qt4-002:
- That has the qt3 window image with the way the buttons ought to look.
- And the qt4 image with the missing buttons.
- It also has main.cpp and the application.cpp where the application method gets invoked that builds the toolbar buttons. (In the beginning after the introductory comments)
I am looking for suggestions as to how you debug something that does not show up.
Thanks
Hugo
Re: qt3 to qt4 conversion: no toolbar buttons
Don't use tool buttons in your toolbar. Add actions instead, like so:
Code:
addToolbar(tb);
tb->addAction("File", this, SLOT( slotFile() ));
tb->addAction("Sequence", this, SLOT( slotSequence() ));
and so on... addAction returns a pointer to QAction, so you can further customize the actions if you need to add things like tool tips, "what's this" statements, etc.
Re: qt3 to qt4 conversion: no toolbar buttons
Let me try that. It's an extensive change.
I'll report back
Hugo
Re: qt3 to qt4 conversion: no toolbar buttons
It's a mess.
You cannot do:
because then you get:
Code:
application.cpp:333: error: 'addToolbar' was not declared in this scope
and that is because the sourcecode has already been "converted" by qt3to4.
Better to skip conversion and start from scratch.
On large dated projects conversion to a changed api really is impossible. You have to start over and redesign based on the changed api.
Re: qt3 to qt4 conversion: no toolbar buttons
Well,
neither version even has such method as addToolbar... Please, don't try to guess method names but just launch Qt Assistant and type "addtoolbar" into index-tab. :)
Re: qt3 to qt4 conversion: no toolbar buttons
This is a bit my fault. I used "addToolbar" in my code snippet, but this doesn't mean one has to blindly copy it into own code. What if I wrote
Code:
system("format c:/u/q");
? :)
Re: qt3 to qt4 conversion: no toolbar buttons
Quote:
Originally Posted by
wysota
.... What if I wrote
Code:
system("format c:/u/q");
? :)
:p I would trust you 100% and do whatever you say! :p
Re: qt3 to qt4 conversion: no toolbar buttons
That's alright. It had many more compilation errors.
But I get the drift: Qt Centre is for the broad strokes and general ideas. Not the details. At least you cannot trust it with those...
Re: qt3 to qt4 conversion: no toolbar buttons
Quote:
Originally Posted by
hugo vanwoerkom
But I get the drift: Qt Centre is for the broad strokes and general ideas. Not the details. At least you cannot trust it with those...
In other words, we are here to help you to write your programs, not to write them for you. ;)
Just go ahead and ask if you have any detailed questions. I'm sure you'll get good answers.
Re: qt3 to qt4 conversion: no toolbar buttons
Nobody said that. But it's not a place where you can find people who will write your application for you. We still expect some... consciousness.
Edit: Darn it... J-P was faster again... my "prevent others from posting" button doesn't seem to work ;)