QT: Different behaviour with ListIcon line breaks

Linux specific forum
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

QT: Different behaviour with ListIcon line breaks

Post by Oma »

Hi!
Concerning all PB-Versions with qt-Subsystem ...

I know it's not a documented behavior and a general incompatibility with Windows (but a good thing for Linux :wink: ).
But since the behavior within qt commands, and also to the gtk differs I would like to mention it here ...

In Linux you always had the possibility to set a line break in cells and header cells of ListIconGadgets with #LF$ in Columns > 0.
In Qt this works when creating for the header cells, but not at all (also standard cells) with SetGadgetItemText() as with the Gtk subsystem.
See example (please try with Qt, Gtk2, Gtk3 to see the difference) ...

Code: Select all

EnableExplicit

; Object constants
#Win_Main  = 0

#LIG1 = 0
#LIG2 = 1

Global.i gEvent, gQuit

Procedure Create_WinMain()
	If OpenWindow(#Win_Main, 300, 200, 400, 270, "qt issue w. ListIcon cell linebreak", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
		TextGadget(#PB_Any,     5,   5, 390,  18, "Please start it under qt and gtk2/gtk3 ...")
		TextGadget(#PB_Any,     5,  35, 390,  18, "Header/cell text with line break set at creation")
		ListIconGadget(#LIG1,   5,  55, 390,  90, "Header line 1" + #LF$ + "Header line 2", 100, #PB_ListIcon_FullRowSelect)
		AddGadgetColumn(#LIG1,  1, "Header line 1" + #LF$ + "Header line 2", 100)
		AddGadgetColumn(#LIG1,  2, "Header line 1" + #LF$ + "Header line 2", 100)
		
		AddGadgetItem  (#LIG1,  -1, "Cell line 1" + #LF$ + "Cell line 2")
		
		
		TextGadget(#PB_Any,     5, 155, 390,  18, "Header/cell text with line break set w. SetGadgetItemText")
		ListIconGadget(#LIG2,   5, 175, 390,  90, "", 100)
		AddGadgetColumn(#LIG2,  1, "", 100)
		AddGadgetColumn(#LIG2,  2, "", 100)
		
		SetGadgetItemText(#LIG2, -1, "Header line 1" + #LF$ + "Header line 2", 0)
		SetGadgetItemText(#LIG2, -1, "Header line 1" + #LF$ + "Header line 2", 1)
		SetGadgetItemText(#LIG2, -1, "Header line 1" + #LF$ + "Header line 2", 2)
		
		AddGadgetItem    (#LIG2, -1, "")
		SetGadgetItemText(#LIG2,  0, "Cell line 1" + #LF$ + "Cell line 2", 1)
		
	EndIf
EndProcedure

Create_WinMain()

Repeat
	gEvent= WaitWindowEvent()
	
	Select gEvent
		Case #PB_Event_CloseWindow
			gQuit= #True
			
	EndSelect
	
Until gQuit
Regards, Charly

PS:
By the way (concerning the dokumentation) ...
There is a flag at ListIconGadgets #PB_ListIcon_FullRowSelect ...
The selection covers the full row instead of the first column (Windows only).
In Gtk2 / Gtk3 (and probably on Mac) this Flag is always aktivated. There's no possibility to select single cells.
In Qt there's the same (or similar) behaviour as on Windows; individual cells are selected by default!. This means the Flag works and is needed but there's no hint in the documentation.
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de