May be you can go for Graphics View framework ? your boxes will be graphics items..I actually want to make several boxes across the screen and give each one several values, such as heigth, width, name, image and be able to receive events from them, ex: click , doubleclick , hover, etc.
or you can have several QWidgets on the screen, so u can get all hover, click etc events..
hope i understood ur prob right![]()
But thats exactly what I'll do. I'll read the number of .xml files in a directory. Then for each .xml file I'll load a QIcon data saved in a node, read other info from other nodes. Then put the QIcon pixmap in a QGraphicsView thats already set up. I need to somehow tie all the .xml nodes together so when I click on, let's say, QGraphicsView.firstChild() I can acess the other info that would be loaded into the same object as the graphic I just clicked. I hope I explained myself clearly. I've already done this using Actionscript 3.0 in Flash, but using QT beats me.
Last edited by been_1990; 16th June 2009 at 18:16.
I guess I started with my left foot in this thread... I started asking something that wont take me to where I want to go. This is what I want to know:
Whats the best way to load a pixmap from a data file? Using QGraphicsView? Or making a new widget for each pixmap? I want to be able to grab events that happen to the object holding the pixmap.
I'm really sorry for the wrong explanation of what I needed, one day I'll get it rigth from the beggining...![]()
QPixmap::load or QPixmap::loadFromDataWhats the best way to load a pixmap from a data file?
That depends on what kind of events you want to capture..and what you want to do on those events.Or making a new widget for each pixmap? I want to be able to grab events that happen to the object holding the pixmap.
For basic mouse clicks and double clicks, use QLabel will be good enough. You can you QLabel in grid layout and show multiple pics..
If you want some anitmation, go for graphics view. You can refer Embedded dialog demo in Qt Demo (since 4.5) . Instead of dialog, you can have your widget or graphics item.
Can refer more if you tell what actions you want to perform on events on the pixmap.
Qt Code:
Functionality needed: Click/Double-Click ; Click&Drag; On Hover animation; Speed; Left-Click menu;To copy to clipboard, switch view to plain text mode
Ok, I'll use QGraphicsView. Now back to my first question, how can I group some data? In a array? Or is there something more "QT"? Ex:
Qt Code:
arrayMain{ obj1{"myname", 01001010-myData, myPlaceInTheWorld}; obj2{"myname", 01401010-myData, myPlaceInTheWorld}; obj3{"myname", 01021010-myData, myPlaceInTheWorld}; obj4{"myname", 01042210-myData, myPlaceInTheWorld}; }To copy to clipboard, switch view to plain text mode
Group it the way you want... I don't really understand the problem. Your data has some structure, so represent that structure using classes and instances of them.
Bookmarks