#pyqt | Logs for 2018-10-23

Back
[01:47:18] <Mrokii> Hello. Is there a way to create some kind of ID for "rows" in a qStandardItemModel that never changes, but that isn't displayed in the view the model is bound to?
[03:04:17] -!- anqxyr has joined #pyqt
[05:13:37] -!- kushal has quit [Remote host closed the connection]
[05:13:56] -!- kushal has joined #pyqt
[06:43:02] -!- mintograde has joined #pyqt
[07:09:52] <altendky> Mrokii: a hidden column?
[07:10:47] <altendky> Mrokii: also note that there are different rules to store data including a user range. You could use a user role to store the id in the first column
[07:21:03] -!- mintograde has quit [Ping timeout: 264 seconds]
[08:46:37] -!- kushal has quit [Ping timeout: 256 seconds]
[08:46:53] -!- kushal has joined #pyqt
[08:53:32] -!- Siecje has joined #pyqt
[08:55:46] -!- kushal has quit [Remote host closed the connection]
[08:57:21] -!- kushal has joined #pyqt
[09:15:53] -!- shakraw has joined #pyqt
[09:28:38] -!- GrandPa-G has joined #pyqt
[09:28:48] <altendky> *different roles
[09:30:32] <GrandPa-G> in qt designer, I am putting a png file on a label that is much bigger. I want the png to start down from top. I tried background-position:10px 50px; Nothing happens. Does this not work on a label?
[09:32:21] <altendky> GrandPa-G: you want to show the png pixel-for-pixel but not centered?
[09:33:29] <GrandPa-G> altendky:right now it is centered but starting at the very top. I would like a bit of padding at top inside the label.
[09:34:03] <GrandPa-G> altendky:the label is 100px x 100px. The png is 50px x 50px
[09:35:19] <altendky> GrandPa-G: what about margins? you need separate x/y control?
[09:36:11] <GrandPa-G> altendky: I am using background-image: url(images/receipt-50.png); to place the png.
[09:39:19] <altendky> GrandPa-G: why not http://doc.qt.io and what about margins? you need separate x/y control?
[09:40:15] <GrandPa-G> altendky:Sorry, I don't understand what you mean by x/y control.
[09:40:23] -!- kushal has quit [Remote host closed the connection]
[09:40:44] <altendky> GrandPa-G: do you really need separate control of the x and y offsets you are trying to achieve?
[09:41:05] -!- kushal has joined #pyqt
[09:42:41] <GrandPa-G> altendky:It is a sloppy substitue for a pushbutton with image. The whole label is just one thing. I just want the image to be a few pixels from the top. It is just a visual appearance thing.
[09:43:24] <altendky> GrandPa-G: you keep saying 'from the top'. does it need to only have the margin on top? or do you want it also on the bottom, left, and right?
[09:43:53] <altendky> GrandPa-G: are you trying to make the image show in different locations at different times such as to indicate the 'button' being depressed?
[09:44:30] <altendky> GrandPa-G: if you want a button, what about http://doc.qt.io
[09:45:10] <altendky> http://doc.qt.io
[09:46:14] <GrandPa-G> altendky:if I could do this with pushbutton in designer, that would be better. But just haven't had any luck. I will try again.
[09:46:36] <altendky> GrandPa-G: i'd much rather have to do something outside designer than hack the wrong widget
[09:47:07] <altendky> GrandPa-G: but in designer i see an icon property under QAbstractButton
[09:48:57] <altendky> if you want the icon to size based on the widget rather than a fixed pixel size you might have to handle the resize event somehow to update the ixonSize
[09:49:02] <altendky> iconSize
[10:42:23] <Mrokii> altendky: Thanks, I'll take a look.
[11:03:24] <Mrokii> I'd like to be able to save an "old" value from a text-item in a qTableView, in case the user changes the text directly in the cell. I've read about reimplementing qstandarditemmodel, but I don't know about the specifics. Does anybody have a working example? Or is there an easier way to somehow save the old value in the model?
[11:04:57] <altendky> Mrokii: i had this in my own custom model (which i'm in the midst of throwing away in favor of an attrs-based python interface with a standard item model backend). basically just when the data changes save the value to a 'backup' location. with a custom model i just implemented the setData() method and in there 'backed up' the value.
[11:05:29] <altendky> Mrokii: with a standard item model you could inherit and override, but that sort of defeats part of my purpose of using it which is to get python out of the model/view communication
[11:06:03] <altendky> Mrokii: so instead you could attach the itemChanged signal to a function that backs up the value, or even just have a custom user role to store the previous value
[11:06:10] <altendky> right on the item itself
[11:07:41] <Mrokii> altendky: Ah yes, I think I understand the concerns. I will look into using the user role, although I haven't really investigated that yet.
[11:09:25] <Mrokii> altendky: Backing up the old data in a function sounds like a good idea.
[11:09:42] <altendky> Mrokii: i just make my own UserRoles enumeration starting at Qt.UserRole. https://github.com (though i think my epyqlib.utils.general.AutoNumberIntEnum might be fairly unneeded and a regular enumeration with auto-numbering might work, i'd have to check)
[11:10:41] <altendky> Mrokii: maybe a dict in a user role named previous_value with the dict keys being the role. then you can backup for multiple roles. *shrug* all depends what you need
[11:11:29] <Mrokii> altendky: I'll investigate it. Not sure which direction I will take. Thanks for the ideas.
[11:18:43] -!- kdas_ has joined #pyqt
[11:19:37] -!- kushal has quit [Ping timeout: 256 seconds]
[11:29:43] kdas_ is now known as kushal
[12:28:58] <GrandPa-G> altendky:even though there was more work to do, I took your advice and switched to qtoolbutton and hard coded the creation. thanks
[12:29:18] <altendky> GrandPa-G: why did you have to hardcode?
[12:30:05] <GrandPa-G> I just wanted to have more control than qtdesigner gave me.
[12:30:18] <altendky> GrandPa-G: sure. over what?
[12:30:43] <altendky> both push and tool buttons inherit from abstract button which has an icon property you can set in designer
[12:31:04] <GrandPa-G> altendky:I think the png files, mainly. Also I could cut/paste quickly.
[12:31:43] <altendky> GrandPa-G: i was able to add a .png in designer as the icon. i'm also not sure what you mean but cut/paste quickly
[12:31:49] <altendky> *mean by
[12:32:04] <altendky> GrandPa-G: it's not clear to me what you were unable to do in designer
[12:32:53] <GrandPa-G> altendky: I don't see any abstract button in designer, but maybe I am not looking the correct place.
[12:33:51] <altendky> GrandPa-G: you wouldn't. place a tool or push button then look in the properties. you will see the properties not only for the push button, but for all things it inherits. in the abstract button section there's an icon entry
[12:34:17] <altendky> GrandPa-G: https://usercontent.irccloud-cdn.com
[12:34:53] <GrandPa-G> altendky:yes, I see what you mean.
[12:35:26] -!- Siecje has quit [Ping timeout: 240 seconds]
[12:42:00] <altendky> GrandPa-G: does that look like what you needed?
[12:43:45] <GrandPa-G> altendky:yes, I think I can go either designer or hardcode. The hardcode always reminds me what I should look for in designer. thanks.
[13:02:29] -!- littlekitty has joined #pyqt
[13:06:50] -!- shakraw has quit [Quit: This computer has gone to sleep]
[13:08:05] -!- Belxjander has quit [Quit: AmigaOSv4.1.6+//PowerPC native]
[13:09:05] -!- Belxjander has joined #pyqt
[14:23:06] -!- anqxyr has quit [Ping timeout: 240 seconds]
[16:24:42] -!- mintograde has joined #pyqt
[16:31:41] -!- Bjander has joined #pyqt
[16:33:32] -!- Belxjander has quit [Ping timeout: 252 seconds]
[16:35:51] -!- Bjander has quit [Read error: Connection reset by peer]
[16:37:51] -!- Belxjander has joined #pyqt
[17:51:08] -!- kallesbar has quit [Quit: Konversation terminated!]
[18:37:51] -!- GrandPa-G has quit [Quit: Leaving]
[20:02:02] -!- littlekitty has quit [Quit: Connection closed for inactivity]
[22:42:02] -!- Mrokii has quit [Ping timeout: 252 seconds]
[22:44:17] -!- mintograde has quit [Ping timeout: 268 seconds]
[22:56:35] -!- Mrokii has joined #pyqt