It is currently Fri Aug 14, 2020 8:49 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [solved] How to activate line-wrap in EditorGadget() with QT
PostPosted: Mon Jul 06, 2020 4:57 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1249
Location: germany
Hi,

using GTK I used
Code:
gtk_text_view_set_wrap_mode_(GadgetID(Gadget.i), #GTK_WRAP_WORD)

to activate line-wrapping inside of an EditorGadget().

Now I need the same for QT. I tried with this:
Code:
QtScript(~"gadget("+Str(Gadget.i)+~").setLineWrapMode(1);")

But I always get
[ERROR] JavaScript error: TypeError: Property 'setLineWrapMode' of object QTextEdit(0x20f3930) is not a function

I checked the QT documentation for QTextEdit class (link) but do not understand why this is not a function? Wrong gadget type?


Last edited by Kukulkan on Tue Jul 07, 2020 11:50 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: How to activate line-wrap in EditorGadget() with QT subs
PostPosted: Mon Jul 06, 2020 9:48 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5810
Location: Germany
If it is a property then it should be accessible like this:
Code:
QtScript(~"gadget("+Str(Gadget.i)+~").lineWrapMode = 1;")


However, there is also a flag for the EditorGadget() which does the same in a cross-platform way: #PB_Editor_WordWrap

_________________
quidquid Latine dictum sit altum videtur


Top
 Profile  
Reply with quote  
 Post subject: Re: How to activate line-wrap in EditorGadget() with QT subs
PostPosted: Mon Jul 06, 2020 11:44 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2612
Location: Germany
Hello freak,

lineWrapMode is default on "1"
Only with flag #PB_EditorWordWrap we can change it with afterwards.
Code:
Runtime Procedure QtSignalHandler()
  MessageRequester("", "Signal received!")
EndProcedure 

If OpenWindow(0, 0, 0, 320, 250, "FrameGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ;EditorGadget(0, 10,  10, 300, 230, #PB_Editor_WordWrap)
  EditorGadget(0, 10,  10, 300, 230)
 
  ; show the EditorGadget object's content
  Debug QtScript("dump(gadget(0))")
 
  Debug "**************"
  Debug QtScript("gadget(0).lineWrapMode")
  ;Debug QtScript("gadget(0).lineWrapMode = 1")
 
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: How to activate line-wrap in EditorGadget() with QT subs
PostPosted: Tue Jul 07, 2020 11:49 am 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 06, 2005 2:35 pm
Posts: 1249
Location: germany
Thanks! Both posts were helpful :-)


Top
 Profile  
Reply with quote  
 Post subject: Re: [solved] How to activate line-wrap in EditorGadget() wit
PostPosted: Tue Jul 07, 2020 6:16 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5810
Location: Germany
If you use #PB_Editor_WordWrap, we set a property called "wordWrapMode". Without setting this property to something other than 0 it seems like the "lineWrapMode" value is ignored. However, this property does not seem to be available in the scripting object. Don't ask me why.
https://doc.qt.io/qt-5/qtextedit.html#wordWrapMode-prop

You can change #PB_Editor_WordWrap also after creating the gadget with SetGadgetAttribute() as well btw.

_________________
quidquid Latine dictum sit altum videtur


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye