Qt Forum - programming with C++ and Qt
Register Calendar Members List Team Members Search Frequently Asked Questions Go to the Main Page

Qt Forum - programming with C++ and Qt » QtForum.org » Qt » Qt Programming » stylesheet for menuitem » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Recommend to a Friend | Add Thread to Favorites
Post New Thread Post Reply
Go to the bottom of this page stylesheet for menuitem
Author
Post « Previous Thread | Next Thread »
sgh sgh is a male
Senior Software Engineer


Registration Date: 17.03.2008
Posts: 77

Level: 14 [?]
Experience: 4,640
Next Level: 5,517

877 points of experience needed for next level

Achtung stylesheet for menuitem Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

hi,
i'm change interface of my project, but got some issue.
one of them just is stylesheet for menuitem.
i intend to change my interface with below this picture.
i tried many ways to do it and i have been done it with proper way, but others issue occured.
so i tried to use stylesheet.
the code says
QMenu {
background: rgb(255, 255, 255);
}

QMenu::item {
padding: 2px 25px 2px 25px;
border: 1px solid transparent;
}

QMenu::item:selected:enabled {
border-color: rgb(255, 189, 105);
background: rgba(255, 231, 162, 150);
}

QMenu::separator {
height: 2px;
background: rgb(173, 209, 255);
margin-left: 25px;
}

QMenu::indicator {
width: 13px;
height: 13px;
}
i don't know how to change first code (background: rgb(255, 255, 255) to make my completion interface.
can anybody help me?
thanks

sgh has attached this image (reduced version):
1.jpg

This post has been edited 2 time(s), it was last edited by sgh: 08.05.2008 08:45.

08.05.2008 08:42 sgh is offline Send an Email to sgh Search for Posts by sgh Add sgh to your Buddy List View the MSN Profile for sgh
s_p_t10
Assistant


Registration Date: 08.05.2008
Posts: 4

Level: 3 [?]
Experience: 32
Next Level: 54

22 points of experience needed for next level

Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

You can try
background-color:qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #147CB4, stop: .2 #ffffff stop: 1 #ffffff);

you can play around with the colors and stops to get it right.
08.05.2008 21:30 s_p_t10 is offline Send an Email to s_p_t10 Search for Posts by s_p_t10 Add s_p_t10 to your Buddy List
sgh sgh is a male
Senior Software Engineer


Registration Date: 17.03.2008
Posts: 77

Level: 14 [?]
Experience: 4,640
Next Level: 5,517

877 points of experience needed for next level

Thread Starter Thread Started by sgh
Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

quote:
Originally posted by s_p_t10
You can try
background-color:qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #147CB4, stop: .2 #ffffff stop: 1 #ffffff);

you can play around with the colors and stops to get it right.


hi,s_p_t10
i tried already for a long days ago.
when i did with your help, the problem occur.
my menuitem size(width) is changeable. that is sizes are all different.
but the area of displaying in menuitem(bright green color, part of icon) is static.
can you give me any idea?
thanks for reply
09.05.2008 03:00 sgh is offline Send an Email to sgh Search for Posts by sgh Add sgh to your Buddy List View the MSN Profile for sgh
Nicolas SOUCHON
Wizard


Registration Date: 27.06.2007
Posts: 726

Level: 29 [?]
Experience: 235,465
Next Level: 242,754

7,289 points of experience needed for next level

Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

try avoiding padding and border on QMenu::item

__________________
Nicolas
09.05.2008 19:38 Nicolas SOUCHON is online Send an Email to Nicolas SOUCHON Search for Posts by Nicolas SOUCHON Add Nicolas SOUCHON to your Buddy List
sgh sgh is a male
Senior Software Engineer


Registration Date: 17.03.2008
Posts: 77

Level: 14 [?]
Experience: 4,640
Next Level: 5,517

877 points of experience needed for next level

Thread Starter Thread Started by sgh
Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

quote:
Originally posted by Nicolas SOUCHON
try avoiding padding and border on QMenu::item

i dont understand "try avoiding padding and border on QMenu::item".
you mean QMenu::item delete?
i tried to do this, but result is not fine.
and to be more precise, color is showed item not to have icon.
the picture is like below
well, can you write code exactly or suggest any idea?

sgh has attached this image (reduced version):
1.jpg

This post has been edited 1 time(s), it was last edited by sgh: 10.05.2008 06:05.

10.05.2008 06:03 sgh is offline Send an Email to sgh Search for Posts by sgh Add sgh to your Buddy List View the MSN Profile for sgh
s_p_t10
Assistant


Registration Date: 08.05.2008
Posts: 4

Level: 3 [?]
Experience: 32
Next Level: 54

22 points of experience needed for next level

Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

For variable menu item lengths, here is what works for me:

QMenu {
background-color:white;
background-image: url(../qss/menuBack.png) ;
background-repeat: repeat-y;
}

QMenu::item {
padding: 2px 25px 2px 25px;
border: 1px solid transparent;
}

QMenu::item:selected:enabled {
border-color: rgb(250, 170, 60);
background: rgba(250, 170, 60, 50);
}

QMenu::separator {
height: 2px;
background: rgb(168, 216, 235);
margin-left: 25px;
}

QMenu::indicator {
width: 13px;
height: 13px;
}
where menuBack.png is attached

s_p_t10 has attached this image:
menuBack.png

12.05.2008 21:08 s_p_t10 is offline Send an Email to s_p_t10 Search for Posts by s_p_t10 Add s_p_t10 to your Buddy List
sgh sgh is a male
Senior Software Engineer


Registration Date: 17.03.2008
Posts: 77

Level: 14 [?]
Experience: 4,640
Next Level: 5,517

877 points of experience needed for next level

Thread Starter Thread Started by sgh
Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

hi,s_p_t10
thanks for reply.
and this is one of good ways, but i tried to do already.
then i found some problem while using image in qss happen when i did open with.
in other words, i open properly files by open with when clicking right button, my app doesnt do reference image(menuBack.png).
i dont knwo why it happen.
so i did mind to use way out of using image, but i have issue here.
can you tell me other idea?
13.05.2008 02:25 sgh is offline Send an Email to sgh Search for Posts by sgh Add sgh to your Buddy List View the MSN Profile for sgh
s_p_t10
Assistant


Registration Date: 08.05.2008
Posts: 4

Level: 3 [?]
Experience: 32
Next Level: 54

22 points of experience needed for next level

Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Are you trying to say that if you use right click 'open with' to start your app, then the image is not found, so you want to have a solution without using images?

In that case, you should create a qrc from all your resources and embedd the qrc into your app. That way you can use :/ to refer to the image path. See http://doc.trolltech.com/4.4/resources.html for more details on qrc.

Sharmila.
13.05.2008 19:19 s_p_t10 is offline Send an Email to s_p_t10 Search for Posts by s_p_t10 Add s_p_t10 to your Buddy List
sgh sgh is a male
Senior Software Engineer


Registration Date: 17.03.2008
Posts: 77

Level: 14 [?]
Experience: 4,640
Next Level: 5,517

877 points of experience needed for next level

Thread Starter Thread Started by sgh
Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

thanks for reply.
and my working is fine by your help.
i saw documents for it for a few days ago, but i missed one problem so i had some wrong, but now is fine.
thanks again.
Yesterday, 02:51 sgh is offline Send an Email to sgh Search for Posts by sgh Add sgh to your Buddy List View the MSN Profile for sgh
Tree Structure | Board Structure
Jump to:
Post New Thread Post Reply
Qt Forum - programming with C++ and Qt » QtForum.org » Qt » Qt Programming » stylesheet for menuitem

views today: 9.027 | views yesterday: 17.520 | total views: 10.242.396


Klebekork Shop - Linux Shop - Kontaktanzeigen - Linux Forum -  SMS Gewinnspiel -  Hotels -  Stadtpläne -  Branchenbuch & Stadtplan

Branchenbuch Österreich - Branchenbuch Niederlande - Portugal Branchenverzeichnis - Spanien Branchenverzeichnis 
Telefonbuch - Branchenbuch Frankreich