Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, March 2007
Tree Item with Icon


Message 1 in thread

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40";>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=RO link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-US style='font-size:
10.0pt;font-family:Arial'>Hi there,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-US style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-US style='font-size:
10.0pt;font-family:Arial'>I have built a QTreeView on which the items have
attached icons.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-US style='font-size:
10.0pt;font-family:Arial'>When I select an item, its icon is also selected as
seen in the attached image.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-US style='font-size:
10.0pt;font-family:Arial'>Is it possible to select only the text of the item
without having the icon also selected?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-US style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-US style='font-size:
10.0pt;font-family:Arial'>Regards,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-US style='font-size:
10.0pt;font-family:Arial'>Horia.<o:p></o:p></span></font></p>

</div>

</body>

</html>

Attachment:

Attachment: treeitemwithicon.JPG
Description: JPEG image


Message 2 in thread

The richedit control of Another Company allows, e.g., entering the 
copyright symbol by typing Alt+0169.  Is there any similar functionality 
in QTextEdit (or the other input controls)?

(Assistant and Mr Google don't seem to think so, which is not a good 
sign, but I might be using ineffective keywords.)

--
 [ signature omitted ] 

Message 3 in thread

> The richedit control of Another Company allows, e.g., entering the
> copyright symbol by typing Alt+0169.  Is there any similar
functionality
> in QTextEdit (or the other input controls)?
> 
> (Assistant and Mr Google don't seem to think so, which is not a good
> sign, but I might be using ineffective keywords.)

this entering symbols by typing alt+0169 is actually handled by the OS,
so there is nothing you need to do, it works anywhere where you can
enter text. just try it out!

Cheers,
Peter

--
 [ signature omitted ] 

Message 4 in thread

Peter Prade wrote:

> this entering symbols by typing alt+0169 is actually handled by the OS,
> so there is nothing you need to do, it works anywhere where you can
> enter text.

There's no OS support worth mentioning.  I'll see about trapping Alt+0 
instead.

--
 [ signature omitted ] 

Message 5 in thread

Forrest schrieb:
> The richedit control of Another Company allows, e.g., entering the 
> copyright symbol by typing Alt+0169.  Is there any similar functionality 
> in QTextEdit (or the other input controls)?

Try the context menu of Qts text widgets; there's an option to insert 
unicode characters.

Martin

-- 
 [ signature omitted ] 

Message 6 in thread

Martin Gebert wrote:

> Try the context menu of Qts text widgets; there's an option to insert 
> unicode characters.

Unfortunately, that's limited to a handful of layout-oriented 
characters...and I overrode the default context menu anyway.

Event filters to the rescue...

--
 [ signature omitted ] 

Message 7 in thread

>I have built a QTreeView on which the items have attached icons.
>When I select an item, its icon is also selected as seen in the
attached >image.
>Is it possible to select only the text of the item without having the
icon >also selected?

Afaik, this is handled in the style.

You'll have to subclass the style that you want and reimplement the
styleHint function. The stylehint to handle differently is
QStyle::SH_ItemView_ShowDecorationSelected.

see also 
http://doc.trolltech.com/4.2/qstyle.html#StyleHint-enum

Cheers,

Peter

--
 [ signature omitted ] 

Message 8 in thread

Hi,

Thanks for your answer.

I have defined this class:

class MyStyle : public QWindowsStyle
 {
  public:
     MyStyle() {}

     int styleHint(StyleHint hint, const QStyleOption *option,
                  const QWidget *widget, QStyleHintReturn *returnData) const
	 {
		if ( hint == SH_ItemView_ShowDecorationSelected )
		{
			return int(false);
		}
		else
		{
		   QWindowsStyle::styleHint(hint, option, widget, returnData);
		}
	 }
 };


An use it like this:

MyStyle *tmpStyle = new MyStyle();
myTreeView->setStyle(tmpStyle);


Still, the icon gets selected...:(

Horia.

-----Original Message-----
From: Peter Prade [mailto:prade@xxxxxxxxxxx] 
Sent: Tuesday, March 27, 2007 1:00 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: AW: Tree Item with Icon

>I have built a QTreeView on which the items have attached icons.
>When I select an item, its icon is also selected as seen in the
attached >image.
>Is it possible to select only the text of the item without having the
icon >also selected?

Afaik, this is handled in the style.

You'll have to subclass the style that you want and reimplement the
styleHint function. The stylehint to handle differently is
QStyle::SH_ItemView_ShowDecorationSelected.

see also 
http://doc.trolltech.com/4.2/qstyle.html#StyleHint-enum

Cheers,

Peter

--
 [ signature omitted ]