[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] How to Generate a "Header Clicked" event for a QTableWidget in PyQt5
From:       Eric A <eaa603 () hotmail ! com>
Date:       2017-08-22 20:56:20
Message-ID: PS1PR02MB1372897065ACC5C45B87DF769F840 () PS1PR02MB1372 ! apcprd02 ! prod ! outlook ! com
[Download RAW message or body]

Kyle,


Thanks for the response which solved my problem.


Its not easy finding one's way through the Qt documentation - more PyQt tut=
orials on using some of the lesser-used classes/properties/methods/signals =
would help.


Eric.


________________________________
From: Kyle Altendorf <sda@fstab.net>
Sent: Friday, 18 August 2017 12:56 a.m.
To: Eric A
Cc: pyqt@riverbankcomputing.com
Subject: Re: [PyQt] How to Generate a "Header Clicked" event for a QTableWi=
dget in PyQt5

On 2017-08-16 23:45, Eric A wrote:

> I am using PyQt5 and Python 3.5
>
> I see that in PyQt4 there's a "sectionClicked" event for the header in
> a
> QTableWidget in PyQt4, but I don't seem to be able to find that method
> to generate the event signal in PyQt5.

I'm thinking it will be:
your_table_widget.horizontalHeader().sectionClicked.connect(your_callable)

http://doc.qt.io/qt-5/qtableview.html#horizontalHeader
QTableView Class | Qt Widgets 5.9<http://doc.qt.io/qt-5/qtableview.html#hor=
izontalHeader>
doc.qt.io
Detailed Description. The QTableView class provides a default model/view im=
plementation of a table view. A QTableView implements a table view that dis=
plays items from ...



http://doc.qt.io/qt-5/qheaderview.html#sectionClicked
QHeaderView Class | Qt Widgets 5.9<http://doc.qt.io/qt-5/qheaderview.html#s=
ectionClicked>
doc.qt.io
Detailed Description. The QHeaderView class provides a header row or header=
 column for item views. A QHeaderView displays the headers used in item vie=
ws such as the ...




Cheers,
-kyle

[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} \
--></style> </head>
<body dir="ltr">
<div id="divtagdefaultwrapper" \
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" \
dir="ltr"> <p>Kyle,</p>
<p><br>
</p>
<p>Thanks for the response which solved my problem.</p>
<p><br>
</p>
<p>Its not easy finding one's way through the Qt documentation - more PyQt tutorials \
on using some of the lesser-used classes/properties/methods/signals would help.</p> \
<p><br> </p>
<p>Eric.</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" \
style="font-size:11pt"><b>From:</b> Kyle Altendorf &lt;sda@fstab.net&gt;<br> \
<b>Sent:</b> Friday, 18 August 2017 12:56 a.m.<br> <b>To:</b> Eric A<br>
<b>Cc:</b> pyqt@riverbankcomputing.com<br>
<b>Subject:</b> Re: [PyQt] How to Generate a &quot;Header Clicked&quot; event for a \
QTableWidget in PyQt5</font> <div>&nbsp;</div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On 2017-08-16 23:45, Eric A wrote:<br>
<br>
&gt; I am using PyQt5 and Python 3.5<br>
&gt; <br>
&gt; I see that in PyQt4 there's a &quot;sectionClicked&quot; event for the header in \
<br> &gt; a<br>
&gt; QTableWidget in PyQt4, but I don't seem to be able to find that method<br>
&gt; to generate the event signal in PyQt5.<br>
<br>
I'm thinking it will be:<br>
your_table_widget.horizontalHeader().sectionClicked.connect(your_callable)<br>
<br>
<a href="http://doc.qt.io/qt-5/qtableview.html#horizontalHeader" id="LPlnk818728" \
previewremoved="true">http://doc.qt.io/qt-5/qtableview.html#horizontalHeader</a> <div \
id="LPBorder_GT_15034350117240.11377065929136543" style="margin-bottom: 20px; \
overflow: auto; width: 100%; text-indent: 0px;"> <table \
id="LPContainer_15034350117220.176215501307595" role="presentation" cellspacing="0" \
style="width: 90%; background-color: rgb(255, 255, 255); position: relative; \
overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; \
border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, \
200);"> <tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_15034350117230.9422348742114379" colspan="2" style="vertical-align: \
top; position: relative; padding: 0px; display: table-cell;"> <div \
id="LPRemovePreviewContainer_15034350117230.422988975234321"></div> <div \
id="LPTitle_15034350117230.8914750077121356" style="top: 0px; color: rgb(0, 120, \
215); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, \
&quot;Segoe UI Light&quot;, &quot;Segoe WP Light&quot;, &quot;Segoe UI&quot;, \
&quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; line-height: 21px;"> <a \
id="LPUrlAnchor_15034350117230.48616206556968256" \
href="http://doc.qt.io/qt-5/qtableview.html#horizontalHeader" target="_blank" \
style="text-decoration: none;">QTableView Class | Qt Widgets 5.9</a></div> <div \
id="LPMetadata_15034350117230.7099902474071471" style="margin: 10px 0px 16px; color: \
rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe \
UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; \
line-height: 14px;"> doc.qt.io</div>
<div id="LPDescription_15034350117230.292834257456817" style="display: block; color: \
rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe \
UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; \
line-height: 20px; max-height: 100px; overflow: hidden;"> Detailed Description. The \
QTableView class provides a default model/view implementation of a table view. A \
QTableView implements a table view that displays items from ...</div> </td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
<a href="http://doc.qt.io/qt-5/qheaderview.html#sectionClicked" id="LPlnk261353" \
previewremoved="true">http://doc.qt.io/qt-5/qheaderview.html#sectionClicked</a> <div \
id="LPBorder_GT_15034350117710.3660099515625832" style="margin-bottom: 20px; \
overflow: auto; width: 100%; text-indent: 0px;"> <table \
id="LPContainer_15034350117690.21029446807101215" role="presentation" cellspacing="0" \
style="width: 90%; background-color: rgb(255, 255, 255); position: relative; \
overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; \
border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, \
200);"> <tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_15034350117700.5833691948984889" colspan="2" style="vertical-align: \
top; position: relative; padding: 0px; display: table-cell;"> <div \
id="LPRemovePreviewContainer_15034350117700.06448547922615688"></div> <div \
id="LPTitle_15034350117700.1373294965958538" style="top: 0px; color: rgb(0, 120, \
215); font-weight: normal; font-size: 21px; font-family: wf_segoe-ui_light, \
&quot;Segoe UI Light&quot;, &quot;Segoe WP Light&quot;, &quot;Segoe UI&quot;, \
&quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; line-height: 21px;"> <a \
id="LPUrlAnchor_15034350117700.07594823758902547" \
href="http://doc.qt.io/qt-5/qheaderview.html#sectionClicked" target="_blank" \
style="text-decoration: none;">QHeaderView Class | Qt Widgets 5.9</a></div> <div \
id="LPMetadata_15034350117700.9596616043364248" style="margin: 10px 0px 16px; color: \
rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, &quot;Segoe \
UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: 14px; \
line-height: 14px;"> doc.qt.io</div>
<div id="LPDescription_15034350117700.32209735380250093" style="display: block; \
color: rgb(102, 102, 102); font-weight: normal; font-family: wf_segoe-ui_normal, \
&quot;Segoe UI&quot;, &quot;Segoe WP&quot;, Tahoma, Arial, sans-serif; font-size: \
14px; line-height: 20px; max-height: 100px; overflow: hidden;"> Detailed Description. \
The QHeaderView class provides a header row or header column for item views. A \
QHeaderView displays the headers used in item views such as the ...</div> </td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
<br>
Cheers,<br>
-kyle<br>
</div>
</span></font></div>
</div>
</body>
</html>


[Attachment #4 (unknown)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic