#pyqt | Logs for 2018-11-02

Back
[03:27:38] -!- stlmxy has joined #pyqt
[03:49:15] -!- anqxyr has joined #pyqt
[04:58:29] -!- Belxjander has joined #pyqt
[06:17:45] -!- mintograde has joined #pyqt
[06:48:53] -!- kallesbar has joined #pyqt
[07:01:39] -!- mintograde has quit [Ping timeout: 244 seconds]
[07:17:10] -!- Mrokii has joined #pyqt
[07:19:25] <Mrokii> Hello. I have created an empty grid-layout (within a frame) in Qt Designer and wanted to somehow get the size of the layout via sizeHint(). The reason is I want to create the cells in the grid in dependence of the space that is available (the window is resizable, so in theory, the grid-layout should resize as well).
[07:20:19] <Mrokii> However, when I try to print sizeHint of the grid-layout I get 0,0. I wonder why that is or of there is another way to get the actual size (or maybe the available size in the frame that contains the grid-layout).
[08:05:26] <altendky> Mrokii: you need to make it actually be the layout for the 'frame' rather than simply being in the frame.
[08:05:41] <altendky> Mrokii: also, by default stuff will resize automatically
[08:06:56] <altendky> Mrokii: what widgets are you going to put in the layout? Are you inserting them in designer?
[08:10:00] <altendky> Mrokii: http://doc.qt.io
[08:13:01] <Mrokii> altendky: Nope, all the contents will be added via code.
[08:18:31] <altendky> Mrokii: do you see what to do?
[08:18:54] <Mrokii> altendky: Yeah, I think so. It seems to work now.
[09:11:01] -!- Siecje has joined #pyqt
[09:23:39] -!- stlmxy has quit [Ping timeout: 256 seconds]
[09:30:59] -!- tijensse has joined #pyqt
[12:42:23] <Mrokii> Here's another problem I'm having at the moment. I am trying to load a pixmap into a label. The loading works, but I can't seem to resize the pixmap nor the label to a certain size (they're always the same, probably pre-defined size). I've tried something like "my_image = QPixmap(str(path_to_image)).scaled(QSize(300, 300))" / "my_image_lbl.setPixmap(my_image)" and "my_image_lbl.resize(QSize(300, 300))".
[12:42:46] <altendky> Mrokii: what is the big picture goal?
[12:42:57] <Mrokii> altendky: What do you mean?
[12:42:58] <altendky> (setting hardcoded pixel sizes isn't a great idea)
[12:43:22] <altendky> Mrokii: why are you trying to force a size on the label?
[12:44:31] <Mrokii> altendky: I am not sure. I guess that was one of the things I tried when the thing didn't work. The actual size is not relevant at the moment, it's just to show images in a grid-like pattern.
[12:45:15] <altendky> Mrokii: ok. don't force sizes mostly. work with size policies to express yourself (though yeah, they take some practice)
[12:45:23] <altendky> Mrokii: but, what didn't work?
[12:46:06] <Mrokii> altendky: Well, my assumption is that (for the commands above) the image would be shown with a width and height of 300 Pixels. But they're always the same size on the screen.
[12:46:37] <altendky> Mrokii: it's in a layout though, right?
[12:47:28] <Mrokii> altendky: Yes, in a grid layout, placed via "addWidget". That part seems to work fine, at least I see the pictures arranged in a number of rows / columns.
[12:47:58] <altendky> Mrokii: do you see how you are making conflicting requests of qt? you asked it to handle laying out the widgets but you also tried to choose the size manually
[12:50:19] <Mrokii> altendky: But how else should I achieve a certain size for all images and have them arranged in a grid?
[12:50:52] <altendky> Mrokii: are you wanting a grid that you can scroll through?
[12:51:17] <Mrokii> altendky: That's the plan later on.
[12:51:50] <Mrokii> altendky: I can't be certain that all images will be visible in the area i am using for them.
[12:51:51] <altendky> Mrokii: ok, that brings back a degree of freedom.
[12:53:10] <altendky> Mrokii: i would probably not leave that until later because otherwise you may not really have that freedom. i forget the details of windows holding their size etc.
[12:55:07] <Mrokii> altendky: I'm not quite sure what you mean. I guess I could just add a scroll area via Qt Designer and work with that on this problem.
[12:55:57] <altendky> Mrokii: the 'default' state of a window and widgets is that you can resize the window and the widgets adjust.
[12:56:42] <Mrokii> altendky: That goes for displayed images as well?
[12:56:44] <altendky> Mrokii: but, there's set fixed size, and size policy of fixed that could/will be relevant
[12:56:53] <altendky> Mrokii: your 'displayed image' is in a widget, right?
[12:57:18] <altendky> Mrokii: and fyi, label isn't really a great picture show'er usually.
[12:57:50] <Mrokii> altendky: yes, it's in a label. And I'm just using it as I have read about it being recommended when I searched the net.
[12:58:45] <altendky> Mrokii: in my experience it doesn't end up holding aspect ratio of the image etc at various sizes.
[12:59:13] <Mrokii> altendky: Then what would you suggest as an alternative?
[13:00:03] <altendky> Mrokii: i was searching for the things i had done to help other people. https://gist.github.com and https://gist.github.com are relevant. i'm not saying you should use them, but i don't expect just qlabels to keep you happy
[13:01:53] <Mrokii> altendky: I need to investigate that further, thanks for the links.
[13:15:33] -!- Siecje has quit [Quit: Leaving.]
[14:48:30] -!- Siecje has joined #pyqt
[16:34:28] -!- mintograde has joined #pyqt
[16:49:42] -!- Siecje has parted #pyqt
[17:48:45] -!- anqxyr has quit [Read error: Connection reset by peer]
[18:15:36] -!- Belxjander has quit [Ping timeout: 272 seconds]
[19:13:27] -!- kallesbar has quit [Read error: Connection reset by peer]
[19:14:11] -!- kallesbar has joined #pyqt
[19:50:35] -!- Belxjander has joined #pyqt
[19:53:35] -!- Bjander has joined #pyqt
[19:55:03] -!- Belxjander has quit [Ping timeout: 245 seconds]
[19:55:04] Bjander is now known as Belxjander
[22:30:21] -!- minto has joined #pyqt
[22:32:41] -!- mintograde has quit [Ping timeout: 260 seconds]
[22:51:02] -!- Belxjander has quit [Quit: AmigaOSv4.1.6+//PowerPC native]
[22:51:27] -!- Belxjander has joined #pyqt
[23:07:41] -!- rlf1 has joined #pyqt
[23:08:29] -!- rlf1 has quit [Remote host closed the connection]
[23:08:53] -!- Mrokii_ has joined #pyqt
[23:11:39] -!- Mrokii has quit [Ping timeout: 252 seconds]
[23:11:39] Mrokii_ is now known as Mrokii