From: Thomas F. <tho...@ru...> - 2015-01-07 21:22:20
|
Git commit d8ed35d56b896a77f97d2fd759d903f5081972df by Thomas Friedrichsmeier. Committed on 07/01/2015 at 21:21. Pushed by tfry into branch 'master'. Some tweaks to <matrix> element M +4 -4 doc/rkwardplugins/index.docbook M +5 -1 rkward/plugin/rkmatrixinput.cpp http://commits.kde.org/rkward/d8ed35d56b896a77f97d2fd759d903f5081972df diff --git a/doc/rkwardplugins/index.docbook b/doc/rkwardplugins/index.docbook index 6fe22aa..134146b 100644 --- a/doc/rkwardplugins/index.docbook +++ b/doc/rkwardplugins/index.docbook @@ -3069,19 +3069,19 @@ made checkable, thus acting like a simple checkbox at the same time. </varlistentry> <varlistentry> <term><parameter>fixed_width</parameter></term> - <listitem><para>Force the GUI element to stay at its initial width. Do not use in combindation with matrices, where the number of columns may change in any way. Useful, esp. when creating a vector input element (rows="1"). (optional, defaults to false).</para></listitem> + <listitem><para>Force the GUI element to stay at its initial width. Do not use in combination with matrices, where the number of columns may change in any way. Useful, esp. when creating a vector input element (rows="1"). With this option set to true, no vertical scroll bar will be shown, even in the matrix exceeds the available height (as this would affect the width). (optional, defaults to false).</para></listitem> </varlistentry> <varlistentry> <term><parameter>fixed_height</parameter></term> - <listitem><para>Force the GUI element to stay at its initial height. Do not use in combindation with matrices, where the number of rows may change in any way. Useful, esp. when creating a vector input element (columns="1"). (optional, defaults to false).</para></listitem> + <listitem><para>Force the GUI element to stay at its initial height. Do not use in combination with matrices, where the number of rows may change in any way. Useful, esp. when creating a vector input element (columns="1"). With this option set to true, no horizontal scroll bar will be shown, even in the matrix exceeds the available width (as this would affect the height). (optional, defaults to false).</para></listitem> </varlistentry> <varlistentry> <term><parameter>horiz_headers</parameter></term> - <listitem><para>Strings to ues for the horiztonal header, separated by ";". (optional, defaults to column number).</para></listitem> + <listitem><para>Strings to ues for the horiztonal header, separated by ";". The header will be hidden, if set to "". (optional, defaults to column number).</para></listitem> </varlistentry> <varlistentry> <term><parameter>vert_headers</parameter></term> - <listitem><para>Strings to ues for the vertical header, separated by ";". (optional, defaults to row number).</para></listitem> + <listitem><para>Strings to ues for the vertical header, separated by ";". The header will be hidden, if set to "". (optional, defaults to row number).</para></listitem> </varlistentry> </variablelist></para></listitem> </varlistentry> diff --git a/rkward/plugin/rkmatrixinput.cpp b/rkward/plugin/rkmatrixinput.cpp index 652e5f0..1d768dd 100644 --- a/rkward/plugin/rkmatrixinput.cpp +++ b/rkward/plugin/rkmatrixinput.cpp @@ -2,7 +2,7 @@ rkmatrixinput - description ------------------- begin : Tue Oct 09 2012 - copyright : (C) 2012 by Thomas Friedrichsmeier + copyright : (C) 2012, 2015 by Thomas Friedrichsmeier email : tf...@us... ***************************************************************************/ @@ -83,17 +83,21 @@ RKMatrixInput::RKMatrixInput (const QDomElement& element, RKComponent* parent_co model = new RKMatrixInputModel (this); QString headers = xml->getStringAttribute (element, "horiz_headers", QString (), DL_INFO); if (!headers.isEmpty ()) model->horiz_header = headers.split (';'); + else if (!headers.isNull ()) display->horizontalHeader ()->hide (); // attribute explicitly set to "" headers = xml->getStringAttribute (element, "vert_headers", QString (), DL_INFO); if (!headers.isEmpty ()) model->vert_header = headers.split (';'); + else if (!headers.isNull ()) display->verticalHeader ()->hide (); updateAll (); display->setModel (model); display->setAlternatingRowColors (true); if (xml->getBoolAttribute (element, "fixed_width", false, DL_INFO)) { int max_col = column_count->intValue () - 1; + display->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff); display->setFixedWidth (display->verticalHeader ()->width () + display->columnViewportPosition (max_col) + display->columnWidth (max_col) + display->verticalHeader ()->fontMetrics ().width ("0")); } if (xml->getBoolAttribute (element, "fixed_height", false, DL_INFO)) { int max_row = row_count->intValue () - 1; + display->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff); display->setFixedHeight (display->horizontalHeader ()->height () + display->rowViewportPosition (max_row) + display->rowHeight (max_row)); } |