Go Back   maemo.org - Talk > OS / Platform > Development
 
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
  #1  
Old 2010-06-03, 15:54
smurfy smurfy is offline
 
Join Date: Nov 2009
Posts: 153
Thanks!: 10
Thanked 159 Times in 64 Posts
Default QT UI Problems (Button sizes/Config..)

Hi,

I currently porting my fahrplan app to qt and i run into design problems.

Here are some of my problems.
Thanks in advance for infos about them.

- How can i get my QPushButtons thumb sized (they always fingersized)

- Is there a way to get QPushButton (or QToolButton) without the hildon theme? The problem is that i need a button which is extremly high (2x thumb size) and with the hildon theme it just repeats the texture.

- The Qt buttons support no Markup in the description like the QLabel. so i use (like in the gtk c version) a button and add a label to it which contains the markup. (With setLayout) that worked great with gtk, but with qt the button only fires pressed and no clicked. or release signal. the problem with that is, that the button is inside a scrollbox und if i only have the pressed signal i cant scroll without pressing a button.

- The QTMaemoPickerbuttons don't align the text and valuetext well ( in gtk the button text is centred)

- In gtk i can set the QTMaemoPickerbuttons style to HILDON_BUTTON_STYLE_PICKER which sets the color of the value text to a an active color rater than grey. (only needed if no selector assignt, i set the value text manualy)

- In the QT Designer window i can add a "Line" Element. I tried with QFrame to create a line in my constructor without the .ui file but i had no success.

- Whats the "best-practices" to store own config settings with qt?

Phil
Reply With Quote
  #2  
Old 2010-06-03, 16:22
aspidites aspidites is offline
 
Join Date: Nov 2009
Location: Missouri, USA
Posts: 402
Thanks!: 43
Thanked 229 Times in 125 Posts
Default Re: QT UI Problems (Button sizes/Config..)

(numbers added for reference)
Quote:
Originally Posted by smurfy View Post
Hi,

I currently porting my fahrplan app to qt and i run into design problems.

Here are some of my problems.
Thanks in advance for infos about them.
http://doc.trolltech.com/4.6/stylesheet.html
1 - How can i get my QPushButtons thumb sized (they always fingersized)

2 - Is there a way to get QPushButton (or QToolButton) without the hildon theme? The problem is that i need a button which is extremly high (2x thumb size) and with the hildon theme it just repeats the texture.

3 - The Qt buttons support no Markup in the description like the QLabel. so i use (like in the gtk c version) a button and add a label to it which contains the markup. (With setLayout) that worked great with gtk, but with qt the button only fires pressed and no clicked. or release signal. the problem with that is, that the button is inside a scrollbox und if i only have the pressed signal i cant scroll without pressing a button.

4 - The QTMaemoPickerbuttons don't align the text and valuetext well ( in gtk the button text is centred)

5 - In gtk i can set the QTMaemoPickerbuttons style to HILDON_BUTTON_STYLE_PICKER which sets the color of the value text to a an active color rater than grey. (only needed if no selector assignt, i set the value text manualy)

6 - In the QT Designer window i can add a "Line" Element. I tried with QFrame to create a line in my constructor without the .ui file but i had no success.

7 - Whats the "best-practices" to store own config settings with qt?

Phil
I presume you are using Qt through C++, so please excuse the fact that my code examples are in python. They should be easy enough to translate.

1 - Thumb size must be set manually. source. The last comment there would have been encouraging if not for the fact that Qt is now at version 4.6.3 and that comment was made last year...

2 - The easiest way would probably be with stylesheets.

3 - If you port wwWidgets to Maemo, you can use his QwwRichTextButton, but it would probably be simpler to copy this code from the qtcenter wiki that has a rich text push button implementation.

4 - Use the setValueLayout() property of the QMaemo5ValueButton and set it to "ValueUnderTextCentered"

5 - no clue, sorry.

6 - Perhaps post your code? The following works for me:
Code:
from PyQt4 import QtCore, QtGui

line = QtGui.QFrame(Form)
line.setGeometry(QtCore.QRect(10, 150, 381, 16))
line.setFrameShape(QtGui.QFrame.HLine)
line.setFrameShadow(QtGui.QFrame.Sunken)
line.setObjectName("line")
7 - In most cases, I use QtCore.QSettings. It is possible to use GConf, but that just seems....wrong :-)

[edit]
Added more answers
__________________
aspidites | blog | aspidites@inbox.com

Last edited by aspidites; 2010-06-03 at 16:44.
Reply With Quote
The Following 4 Users Say Thank You to aspidites For This Useful Post:
  #3  
Old 2010-06-03, 16:32
smurfy smurfy is offline
 
Join Date: Nov 2009
Posts: 153
Thanks!: 10
Thanked 159 Times in 64 Posts
Default Re: QT UI Problems (Button sizes/Config..)

Thanks, i will try it.

my source is available here: https://garage.maemo.org/plugins/scm...?root=fahrplan
Reply With Quote
  #4  
Old 2010-06-04, 17:29
smurfy smurfy is offline
 
Join Date: Nov 2009
Posts: 153
Thanks!: 10
Thanked 159 Times in 64 Posts
Default Re: QT UI Problems (Button sizes/Config..)

Ok most of the problem are solved thanks to aspidites, but the only thing i cant get working is the button size.

if i set the button with setFixedHeight or setMinimumHeight the button gets the desired height, but then the theme of the button is incorrect.

happens for push and toolbuttons

edit:

my workaround is now, to set my buttons which needs a different height a different style (gtkstyle)

Last edited by smurfy; 2010-06-04 at 21:39.
Reply With Quote
  #5  
Old 2010-06-16, 20:21
eitama's Avatar
eitama eitama is offline
 
Join Date: Feb 2010
Location: Israel.
Posts: 702
Thanks!: 103
Thanked 334 Times in 186 Posts
Default Re: QT UI Problems (Button sizes/Config..)

Quote:
Originally Posted by smurfy View Post
Ok most of the problem are solved thanks to aspidites, but the only thing i cant get working is the button size.

if i set the button with setFixedHeight or setMinimumHeight the button gets the desired height, but then the theme of the button is incorrect.

happens for push and toolbuttons

edit:

my workaround is now, to set my buttons which needs a different height a different style (gtkstyle)
Hi!

Can you post the code that set the style to GTK style? I have the same repeating problem.
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |
Reply With Quote
  #6  
Old 2010-08-19, 19:00
smurfy smurfy is offline
 
Join Date: Nov 2009
Posts: 153
Thanks!: 10
Thanked 159 Times in 64 Posts
Default Re: QT UI Problems (Button sizes/Config..)

QGtkStyle *gtkStyle = new QGtkStyle();
qPushButtonInstance->setStyle(gtkStyle);
Reply With Quote
  #7  
Old 2010-08-25, 19:41
caco3's Avatar
caco3 caco3 is offline
 
Join Date: May 2010
Location: Switzerland
Posts: 560
Thanks!: 162
Thanked 423 Times in 201 Posts
Default Re: QT UI Problems (Button sizes/Config..)

Hi all

I have the same challenge.
How would I have to do it in python (this seems to be c++ code or so).
And where to you have to place the code?
I generate my UI qith QT Designer and then import the generated python code into my application.

Thank you for your help!
__________________
On N9 check out this:
CacheMe 4 the N9, a geocaching client / MiniBible, a bible viewer / TheWord brings daily bible verses onto your phone / BatteryGraph to monitor the battery drainage / doublepress2unlock to unlock your phone with a double press onto the power button / GPRS Data Usage to monitor your GPRS data usage /
and more...

On N900 check out this: SleepAnalyser to analyse your sleep movements / PasswordMaker a for a password generator
Reply With Quote
  #8  
Old 2010-08-25, 19:45
mikec's Avatar
mikec mikec is offline
 
Join Date: Jan 2006
Posts: 1,366
Thanks!: 1,373
Thanked 1,185 Times in 410 Posts
Default Re: QT UI Problems (Button sizes/Config..)

bug in Qt with PR1.2 where the button height is clipped. You can fix this via a style sheet in qt designer
__________________
N900_Email_Options Wiki Page
Reply With Quote
  #9  
Old 2010-08-25, 20:56
caco3's Avatar
caco3 caco3 is offline
 
Join Date: May 2010
Location: Switzerland
Posts: 560
Thanks!: 162
Thanked 423 Times in 201 Posts
Default Re: QT UI Problems (Button sizes/Config..)

Quote:
Originally Posted by mikec View Post
bug in Qt with PR1.2 where the button height is clipped. You can fix this via a style sheet in qt designer
Hmm, do you have more infos or an example style sheet for maemo?
And if i make a style matching the default theme, how will it look when somebody changes the theme?
I know that other applications solved that issue, but how?
__________________
On N9 check out this:
CacheMe 4 the N9, a geocaching client / MiniBible, a bible viewer / TheWord brings daily bible verses onto your phone / BatteryGraph to monitor the battery drainage / doublepress2unlock to unlock your phone with a double press onto the power button / GPRS Data Usage to monitor your GPRS data usage /
and more...

On N900 check out this: SleepAnalyser to analyse your sleep movements / PasswordMaker a for a password generator
Reply With Quote
  #10  
Old 2010-08-26, 05:40
aspidites aspidites is offline
 
Join Date: Nov 2009
Location: Missouri, USA
Posts: 402
Thanks!: 43
Thanked 229 Times in 125 Posts
Default Re: QT UI Problems (Button sizes/Config..)

Quote:
Originally Posted by caco3 View Post
Hi all

I have the same challenge.
How would I have to do it in python (this seems to be c++ code or so).
And where to you have to place the code?
I generate my UI qith QT Designer and then import the generated python code into my application.

Thank you for your help!
Code:
gtkSTyle = QGtkStyle()
qPushButtonInstance.setStyle(gtkStyle)
Note that qPushButtonInstance is a random button, thus the answer to "where" is right after you instanciate a new button.

Edit: If you are using Qt designer to generate your ui, then after running pyuic create a script that imports the generated module and has as class that subclsses both the generated module and the base class

Kind of like:
Code:
from ui_custom_window import UiCustomWindow

class CustomWindow(UiCustomWindow, QMainWindow):
...
__________________
aspidites | blog | aspidites@inbox.com

Last edited by aspidites; 2010-08-26 at 05:44.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:41.