Hello.
I have been thinking about a couple of days on how to implement this, so far I have tried a couple of approaches, but I wanted to see if someone more knowledgeable can give be a couple of hints on the direction I should be taking for this one.
I want to implement a 3×2 image grid. The images are part of a table in a sqlite database (6 columns, but the table holds more info), that part is already handled and as you can guess the number of images will be 6 or less. I don’t mind having empty places in the grid.
So far, I have been implementing something based on QPushButton, I am setting the images as the icon for each button which mostly works. However I needed a way to zoom the images. On a first stage, this zoom will work this way: you activate the zoom and the relevant button takes over the whole grid, while all its 5 neighbours will be set as hidden.
So far so simple , but, since the clicked() event is being used to assign the image for each button (via a QFileDialog) and QPushButton doesn’t attend doubleclicks or rightclicks I don’t have any straight way to attach any more functionalities to it. Furthermore, I don’t really want to deviate so much from the standards since the final users for this thing will not be too versed in computers. So, the simpler the thing stands, the better.
I have progressed from QPushButtons to QToolButtons, and set their popupMode to MenuButtonPopup. This is surely a better way to handle this and I can attach as much actions as I need to each button, plus the users will see the arrow next to the item, and will therefore feel the “urge” to click it :D It’s more visual and I think it will work just fine.
I wanted to ask if you guys think that this approach is ok for an image grid, and will also like to hear you thought on how would you go about implement this in a different manner.
I don’t know if there’s some simpler way to design an image gallery like this in qt, or even some pre-made widget I can use. I have been considering using some of the *Lists in Icon mode, but I wouldn’t even know how I’d go about implementing the zoom in there without using an extra dialog above my main window, which I’d prefer not to.
Well, thanks for your thoughts or just for reading. ;)
↧