stylesheet for menuitem |
sgh
Senior Software Engineer
   
Registration Date: 17.03.2008
Posts: 77
Level: 14 [?]
Experience: 4,709
Next Level: 5,517
 |
|
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):
This post has been edited 2 time(s), it was last edited by sgh: 08.05.2008 08:45.
|
|
08.05.2008 08:42 |
|
|
s_p_t10
Assistant
Registration Date: 08.05.2008
Posts: 4
Level: 3 [?]
Experience: 35
Next Level: 54
 |
|
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 |
|
|
sgh
Senior Software Engineer
   
Registration Date: 17.03.2008
Posts: 77
Level: 14 [?]
Experience: 4,709
Next Level: 5,517
Thread Starter
 |
|
| 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 |
|
|
Nicolas SOUCHON
Wizard
  
Registration Date: 27.06.2007
Posts: 737
Level: 29 [?]
Experience: 239,692
Next Level: 242,754
 |
|
try avoiding padding and border on QMenu::item
__________________ Nicolas
|
|
09.05.2008 19:38 |
|
|
sgh
Senior Software Engineer
   
Registration Date: 17.03.2008
Posts: 77
Level: 14 [?]
Experience: 4,709
Next Level: 5,517
Thread Starter
 |
|
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 |
|
|
s_p_t10
Assistant
Registration Date: 08.05.2008
Posts: 4
Level: 3 [?]
Experience: 35
Next Level: 54
 |
|
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 |
|
|
sgh
Senior Software Engineer
   
Registration Date: 17.03.2008
Posts: 77
Level: 14 [?]
Experience: 4,709
Next Level: 5,517
Thread Starter
 |
|
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.
|
|
15.05.2008 02:51 |
|
|
|