Hello community,

here is the log from the commit of package libyui-qt for openSUSE:Factory 
checked in at 2019-11-08 15:23:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libyui-qt (Old)
 and      /work/SRC/openSUSE:Factory/.libyui-qt.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libyui-qt"

Fri Nov  8 15:23:29 2019 rev:63 rq:746235 version:2.51.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/libyui-qt/libyui-qt.changes      2019-09-30 
15:52:14.990358170 +0200
+++ /work/SRC/openSUSE:Factory/.libyui-qt.new.2990/libyui-qt.changes    
2019-11-08 15:23:31.190854742 +0100
@@ -1,0 +2,14 @@
+Thu Nov  7 11:02:48 UTC 2019 - Stefan Hundhammer <shundham...@suse.com>
+
+- Left-align ItemSelector toggle and icon if using custom status values,
+  but items without description (bsc#1084674)
+- 2.51.3
+
+-------------------------------------------------------------------
+Thu Oct 31 14:16:40 UTC 2019 - Stefan Hundhammer <shundham...@suse.com>
+
+- Support custom status values (int, not just boolean) in ItemSelector
+  (bsc#1084674)
+- 2.51.2
+
+-------------------------------------------------------------------

Old:
----
  libyui-qt-2.51.1.tar.bz2

New:
----
  libyui-qt-2.51.3.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libyui-qt-doc.spec ++++++
--- /var/tmp/diff_new_pack.dUzQti/_old  2019-11-08 15:23:31.930855525 +0100
+++ /var/tmp/diff_new_pack.dUzQti/_new  2019-11-08 15:23:31.930855525 +0100
@@ -21,7 +21,7 @@
 
 Name:           %{parent}-doc
 # DO NOT manually bump the version here; instead, use   rake version:bump
-Version:        2.51.1
+Version:        2.51.3
 Release:        0
 Source:         %{parent}-%{version}.tar.bz2
 

++++++ libyui-qt.spec ++++++
--- /var/tmp/diff_new_pack.dUzQti/_old  2019-11-08 15:23:31.946855542 +0100
+++ /var/tmp/diff_new_pack.dUzQti/_new  2019-11-08 15:23:31.946855542 +0100
@@ -18,7 +18,7 @@
 
 Name:           libyui-qt
 # DO NOT manually bump the version here; instead, use   rake version:bump
-Version:        2.51.1
+Version:        2.51.3
 Release:        0
 Source:         %{name}-%{version}.tar.bz2
 
@@ -30,7 +30,7 @@
 BuildRequires:  gcc-c++
 BuildRequires:  pkg-config
 
-%define libyui_devel_version libyui-devel >= 3.8.0
+%define libyui_devel_version libyui-devel >= 3.8.3
 BuildRequires:  %{libyui_devel_version}
 BuildRequires:  fontconfig-devel
 BuildRequires:  pkgconfig(Qt5Core)

++++++ libyui-qt-2.51.1.tar.bz2 -> libyui-qt-2.51.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/SOURCECONF.cmake 
new/libyui-qt-2.51.3/SOURCECONF.cmake
--- old/libyui-qt-2.51.1/SOURCECONF.cmake       2019-09-24 15:48:30.000000000 
+0200
+++ new/libyui-qt-2.51.3/SOURCECONF.cmake       2019-11-07 12:11:15.000000000 
+0100
@@ -22,6 +22,7 @@
      YQCheckBoxFrame.cc
      YQComboBox.cc
      YQContextMenu.cc
+     YQCustomStatusItemSelector.cc
      YQDateField.cc
      YQDialog.cc
      YQDownloadProgress.cc
@@ -90,6 +91,7 @@
      YQCheckBoxFrame.h
      YQComboBox.h
      YQContextMenu.h
+     YQCustomStatusItemSelector.h
      YQDateField.h
      YQDialog.h
      YQDownloadProgress.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/VERSION.cmake 
new/libyui-qt-2.51.3/VERSION.cmake
--- old/libyui-qt-2.51.1/VERSION.cmake  2019-09-24 15:48:30.000000000 +0200
+++ new/libyui-qt-2.51.3/VERSION.cmake  2019-11-07 12:11:15.000000000 +0100
@@ -1,6 +1,6 @@
 SET(VERSION_MAJOR "2")
 SET(VERSION_MINOR "51")
-SET(VERSION_PATCH "1")
+SET(VERSION_PATCH "3")
 SET( VERSION 
"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${GIT_SHA1_VERSION}" )
 
 ##### This is needed for the libyui-qt core ONLY.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/package/libyui-qt-doc.spec 
new/libyui-qt-2.51.3/package/libyui-qt-doc.spec
--- old/libyui-qt-2.51.1/package/libyui-qt-doc.spec     2019-09-24 
15:48:30.000000000 +0200
+++ new/libyui-qt-2.51.3/package/libyui-qt-doc.spec     2019-11-07 
12:11:15.000000000 +0100
@@ -21,7 +21,7 @@
 
 Name:           %{parent}-doc
 # DO NOT manually bump the version here; instead, use   rake version:bump
-Version:        2.51.1
+Version:        2.51.3
 Release:        0
 Source:         %{parent}-%{version}.tar.bz2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/package/libyui-qt.changes 
new/libyui-qt-2.51.3/package/libyui-qt.changes
--- old/libyui-qt-2.51.1/package/libyui-qt.changes      2019-09-24 
15:48:30.000000000 +0200
+++ new/libyui-qt-2.51.3/package/libyui-qt.changes      2019-11-07 
12:11:15.000000000 +0100
@@ -1,4 +1,18 @@
 -------------------------------------------------------------------
+Thu Nov  7 11:02:48 UTC 2019 - Stefan Hundhammer <shundham...@suse.com>
+
+- Left-align ItemSelector toggle and icon if using custom status values,
+  but items without description (bsc#1084674)
+- 2.51.3
+
+-------------------------------------------------------------------
+Thu Oct 31 14:16:40 UTC 2019 - Stefan Hundhammer <shundham...@suse.com>
+
+- Support custom status values (int, not just boolean) in ItemSelector
+  (bsc#1084674)
+- 2.51.2
+
+-------------------------------------------------------------------
 Tue Sep 24 13:12:23 UTC 2019 - Stefan Hundhammer <shundham...@suse.com>
 
 - Icon support for ItemSelector widget (bsc#1084674)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/package/libyui-qt.spec 
new/libyui-qt-2.51.3/package/libyui-qt.spec
--- old/libyui-qt-2.51.1/package/libyui-qt.spec 2019-09-24 15:48:30.000000000 
+0200
+++ new/libyui-qt-2.51.3/package/libyui-qt.spec 2019-11-07 12:11:15.000000000 
+0100
@@ -18,7 +18,7 @@
 
 Name:           libyui-qt
 # DO NOT manually bump the version here; instead, use   rake version:bump
-Version:        2.51.1
+Version:        2.51.3
 Release:        0
 Source:         %{name}-%{version}.tar.bz2
 
@@ -30,7 +30,7 @@
 BuildRequires:  gcc-c++
 BuildRequires:  pkg-config
 
-%define libyui_devel_version libyui-devel >= 3.8.0
+%define libyui_devel_version libyui-devel >= 3.8.3
 BuildRequires:  %{libyui_devel_version}
 BuildRequires:  fontconfig-devel
 BuildRequires:  pkgconfig(Qt5Core)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/src/YQCustomStatusItemSelector.cc 
new/libyui-qt-2.51.3/src/YQCustomStatusItemSelector.cc
--- old/libyui-qt-2.51.1/src/YQCustomStatusItemSelector.cc      1970-01-01 
01:00:00.000000000 +0100
+++ new/libyui-qt-2.51.3/src/YQCustomStatusItemSelector.cc      2019-11-07 
12:11:15.000000000 +0100
@@ -0,0 +1,233 @@
+/*
+  Copyright (C) 2019 SUSE LLC
+  This library is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) version 3.0 of the License. This library
+  is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+  License for more details. You should have received a copy of the GNU
+  Lesser General Public License along with this library; if not, write
+  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+  Floor, Boston, MA 02110-1301 USA
+*/
+
+
+/*-/
+
+  File:              YQCustomStatusItemSelector.cc
+
+  Author:     Stefan Hundhammer <shundham...@suse.de>
+
+/-*/
+
+
+#include <QToolButton>
+
+#define YUILogComponent "qt-ui"
+#include <yui/YUILog.h>
+#include <yui/YEvent.h>
+#include "utf8.h"
+#include "YQCustomStatusItemSelector.h"
+#include "YQUI.h"
+
+
+YQCustomStatusItemSelector::YQCustomStatusItemSelector( YWidget *              
             parent,
+                                                        const 
YItemCustomStatusVector &     customStates )
+    : YQItemSelector( parent, customStates )
+{
+    preloadStatusIcons();
+}
+
+
+YQCustomStatusItemSelector::~YQCustomStatusItemSelector()
+{
+    // NOP
+}
+
+
+void YQCustomStatusItemSelector::preloadStatusIcons()
+{
+    _statusIcons.clear();
+
+    for ( int i=0; i < customStatusCount(); ++i )
+        _statusIcons << YQUI::ui()->loadIcon( customStatus( i ).iconName() );
+}
+
+
+void YQCustomStatusItemSelector::addItem( YItem * item )
+{
+    YUI_CHECK_PTR( item );
+    YItemSelector::addItem( item );
+
+    YQCustomStatusSelectorItemWidget * itemWidget =
+        new YQCustomStatusSelectorItemWidget( this, item );
+    YUI_CHECK_NEW( itemWidget );
+
+    itemWidget->createWidgets();
+    _itemWidgets[ item ] = itemWidget;
+
+    connect( itemWidget,        &pclass( itemWidget )::clicked,
+             this,              &pclass( this       )::itemClicked );
+
+    // Intentionally not trying to deselect all other items if this one is
+    // selected because custom status mode guarantees not to have single
+    // selection.
+}
+
+
+void YQCustomStatusItemSelector::selectItem( YItem * item, bool selected )
+{
+    item->setSelected( selected );
+    updateCustomStatusIndicator( item );
+}
+
+
+const QIcon &
+YQCustomStatusItemSelector::statusIcon( int status ) const
+{
+    static QIcon nullIcon = QIcon();
+
+    if ( status >= 0 && status < _statusIcons.size() )
+        return _statusIcons.at( status );
+    else
+        return nullIcon;
+}
+
+
+void YQCustomStatusItemSelector::updateCustomStatusIndicator( YItem * item )
+{
+    YQSelectorItemWidget * itemWidgetBase = _itemWidgets.value( item );
+
+    if ( ! itemWidgetBase )
+       YUI_THROW( YUIException( "Can't find selected item" ) );
+
+    YQCustomStatusSelectorItemWidget * itemWidget =
+        dynamic_cast<YQCustomStatusSelectorItemWidget *>( itemWidgetBase );
+
+    if ( itemWidget )
+        itemWidget->setStatusIcon();
+}
+
+
+void YQCustomStatusItemSelector::itemClicked( YQCustomStatusSelectorItemWidget 
* itemWidget )
+{
+    YUI_CHECK_PTR( itemWidget );
+    YItem * item = itemWidget->item();
+
+    int oldStatus = item->status();
+    int newStatus = cycleCustomStatus( oldStatus );
+
+    yuiDebug() << "User clicked on item \"" << item->label() << "\""
+               << "; new status: " << newStatus
+               << endl;
+
+    if ( newStatus >= 0 && newStatus != oldStatus )
+    {
+        item->setStatus( newStatus );
+        itemWidget->setStatusIcon();
+    }
+
+    // Send the event even if newStatus == -1: This is particularly interesting
+    // for the application so it can handle this on the application level.
+    //
+    // It might not always be useful or practical for the application to
+    // predefine a status transition in the custom status table, in particular
+    // if the next status to use depends on other information.
+
+    if ( notify() )
+        YQUI::ui()->sendEvent( new YMenuEvent( item ) );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+
+
+
+YQCustomStatusSelectorItemWidget::YQCustomStatusSelectorItemWidget( 
YQItemSelector      * parent,
+                                                                    YItem      
        * item )
+    : YQSelectorItemWidget( parent, item )
+{
+
+}
+
+
+YQCustomStatusSelectorItemWidget::~YQCustomStatusSelectorItemWidget()
+{
+    // NOP
+}
+
+
+QAbstractButton *
+YQCustomStatusSelectorItemWidget::createHeadingToggle( const std::string &  
label,
+                                                       QWidget *            
parent )
+{
+    QToolButton * toggle = new QToolButton( this );
+    YUI_CHECK_NEW( toggle );
+    toggle->setText( " " + fromUTF8( label ) );
+    toggle->setAutoRaise( true );
+    toggle->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
+    toggle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, // 
horizontal: let it grow
+                                        QSizePolicy::Fixed ) );        // 
vertical: use sizeHint()
+    setStatusIcon( toggle );
+
+    connect( toggle,    &pclass( toggle )::clicked,
+             this,      &pclass( this   )::slotClicked );
+
+    return toggle;
+}
+
+
+void YQCustomStatusSelectorItemWidget::setStatusIcon()
+{
+    setStatusIcon( _headingToggle );
+}
+
+
+void YQCustomStatusSelectorItemWidget::setStatusIcon( QAbstractButton * toggle 
)
+{
+    int status = _item->status();
+
+    if ( ! _parent->validCustomStatusIndex( status ) )
+    {
+        yuiError() << "Invalid status " << status << " for item " << _item << 
endl;
+        status = 0;
+    }
+
+    YQCustomStatusItemSelector * parent = 
dynamic_cast<YQCustomStatusItemSelector *>( _parent );
+
+    if ( parent )
+    {
+        QIcon icon = parent->statusIcon( status );
+
+        if ( ! icon.isNull() )
+            toggle->setIcon( icon );
+    }
+}
+
+
+int YQCustomStatusSelectorItemWidget::itemDescriptionIndent() const
+{
+    // This magic number in should really come from the widget style and some
+    // queries like
+    //
+    //   style()->pixelMetric( QStyle::PM_RadioButtonLabelSpacing );
+    //
+    // and then added up from all the necessary individual pieces. But most
+    // of those things are never clearly specified. In the Qt code itself
+    // there are gems like "width += 4" at strategic places. So there is no
+    // realistic way for us on this level to do that right.
+
+    return 24;
+}
+
+
+void YQCustomStatusSelectorItemWidget::slotClicked()
+{
+    emit clicked( this );
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/src/YQCustomStatusItemSelector.h 
new/libyui-qt-2.51.3/src/YQCustomStatusItemSelector.h
--- old/libyui-qt-2.51.1/src/YQCustomStatusItemSelector.h       1970-01-01 
01:00:00.000000000 +0100
+++ new/libyui-qt-2.51.3/src/YQCustomStatusItemSelector.h       2019-11-07 
12:11:15.000000000 +0100
@@ -0,0 +1,176 @@
+/*
+  Copyright (C) 2019 SUSE LLC
+  This library is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) version 3.0 of the License. This library
+  is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+  License for more details. You should have received a copy of the GNU
+  Lesser General Public License along with this library; if not, write
+  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+  Floor, Boston, MA 02110-1301 USA
+*/
+
+
+/*-/
+
+  File:              YQCustomStatusItemSelector.h
+
+  Author:     Stefan Hundhammer <shundham...@suse.de>
+
+/-*/
+
+
+#ifndef YQCustomStatusItemSelector_h
+#define YQCustomStatusItemSelector_h
+
+#include "YQItemSelector.h"
+
+
+class YQCustomStatusSelectorItemWidget;
+
+
+/**
+ * ItemSelector widget with support for custom status values, not just 0 or 1.
+ *
+ * This does not use a standard QCheckBox or QRadioButton, but a QToolButton
+ * with an icon that is exchanged whenever the status changes.
+ **/
+class YQCustomStatusItemSelector: public YQItemSelector
+{
+    Q_OBJECT
+
+public:
+
+    /**
+     * Constructor.
+     **/
+    YQCustomStatusItemSelector( YWidget *                           parent,
+                                const YItemCustomStatusVector &     
customStates );
+
+    /**
+     * Destructor.
+     **/
+    virtual ~YQCustomStatusItemSelector();
+
+    /**
+     * Add an item.
+     *
+     * Reimplemented from YQItemSelector / YSelectionWidget.
+     **/
+    virtual void addItem( YItem * item );
+
+    /**
+     * Select or deselect an item.
+     *
+     * Reimplemented from YSelectionWidget.
+     **/
+    virtual void selectItem( YItem * item, bool selected = true );
+
+    /**
+     * Return the status icon for the specified status.
+     **/
+    const QIcon & statusIcon( int status ) const;
+
+
+protected slots:
+
+    /**
+     * Cycle the status of an item and report the click to the calling
+     * application.
+     **/
+    void itemClicked( YQCustomStatusSelectorItemWidget * itemWidget );
+
+
+protected:
+
+    /**
+     * Preload and cache the status icons.
+     **/
+    void preloadStatusIcons();
+
+    /**
+     * Update the status indicator (the status icon) for an item.
+     *
+     * Reimplemented from YItemSelector.
+     **/
+    virtual void updateCustomStatusIndicator( YItem * item );
+
+
+    // Data members
+
+    QList<QIcon>        _statusIcons;
+
+};     // class YQCustomStatusItemSelector
+
+
+
+/**
+ * Class for the widgets of one YQCustomStatusItemSelector item.
+ **/
+class YQCustomStatusSelectorItemWidget: public YQSelectorItemWidget
+{
+    Q_OBJECT
+
+public:
+
+    /**
+     * Constructor.
+     **/
+    YQCustomStatusSelectorItemWidget( YQItemSelector    * parent,
+                                      YItem            * item );
+
+    /**
+     * Destructor.
+     **/
+    virtual ~YQCustomStatusSelectorItemWidget();
+
+    /**
+     * Set the correct status icon according to the status of this item.
+     **/
+    void setStatusIcon();
+
+signals:
+
+    /**
+     * Emitted when the user clicks on the heading toggle to change the status
+     * or uses a keyboard operation to do the same.
+     **/
+    void clicked( YQCustomStatusSelectorItemWidget * itemWidget );
+
+protected slots:
+
+    /**
+     * Forwarder slot from the heading toggle to this class.
+     **/
+    void slotClicked();
+
+protected:
+
+    /**
+     * Create the appropriate toggle button for this item and connect it to
+     * appropriate slots.
+     *
+     * Reimplemented from YQCustomStatusSelectorItemWidget.
+     **/
+    virtual QAbstractButton * createHeadingToggle( const std::string &  label,
+                                                   QWidget *            parent 
);
+
+    /**
+     * Set the correct status icon according to the status of this item.
+     **/
+    void setStatusIcon( QAbstractButton * toggle );
+
+    /**
+     * Return the amount of indentation in pixels for the description text.
+     *
+     * Reimplemented from YQCustomStatusSelectorItemWidget.
+     **/
+    virtual int itemDescriptionIndent() const;
+
+};     // class YQCustomStatusSelectorItemWidget
+
+
+#endif // YQCustomStatusItemSelector_h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/src/YQItemSelector.cc 
new/libyui-qt-2.51.3/src/YQItemSelector.cc
--- old/libyui-qt-2.51.1/src/YQItemSelector.cc  2019-09-24 15:48:30.000000000 
+0200
+++ new/libyui-qt-2.51.3/src/YQItemSelector.cc  2019-11-07 12:11:15.000000000 
+0100
@@ -23,6 +23,7 @@
 /-*/
 
 
+#include <QButtonGroup>
 #include <QCheckBox>
 #include <QHBoxLayout>
 #include <QLabel>
@@ -39,7 +40,6 @@
 #include "YQSignalBlocker.h"
 #include "YQUI.h"
 
-#define ITEM_DESCRIPTION_INDENT         20
 #define ICON_SIZE                       64
 #define VERBOSE_SELECTION               0
 
@@ -51,6 +51,21 @@
     : QScrollArea( (QWidget *) parent->widgetRep() )
     , YItemSelector( parent, enforceSingleSelection )
 {
+    init();
+}
+
+
+YQItemSelector::YQItemSelector( YWidget *                           parent,
+                                const YItemCustomStatusVector &     
customStates )
+    : QScrollArea( (QWidget *) parent->widgetRep() )
+    , YItemSelector( parent, customStates )
+{
+    init();
+}
+
+
+void YQItemSelector::init()
+{
     setWidgetRep( this );
 
     setWidgetResizable( true );
@@ -67,6 +82,9 @@
     outerVBox->addLayout( _itemLayout );
     outerVBox->addStretch( 1000 ); // this takes up any excess space
 
+    _buttonGroup = new QButtonGroup( this );
+    YUI_CHECK_NEW( _buttonGroup );
+
     this->QScrollArea::setWidget( _itemContainer );
 }
 
@@ -79,7 +97,12 @@
 
 void YQItemSelector::addItemWidget( YQSelectorItemWidget * itemWidget )
 {
+    YUI_CHECK_PTR( itemWidget );
+
     _itemLayout->addWidget( itemWidget );
+
+    if ( enforceSingleSelection() )
+        _buttonGroup->addButton( itemWidget->headingToggle() );
 }
 
 
@@ -91,6 +114,7 @@
     YQSelectorItemWidget * itemWidget = new YQSelectorItemWidget( this, item );
     YUI_CHECK_NEW( itemWidget );
 
+    itemWidget->createWidgets();
     _itemWidgets[ item ] = itemWidget;
 
     connect( itemWidget,        &pclass( itemWidget )::selectionChanged,
@@ -277,16 +301,6 @@
     , _parent( parent )
     , _item( item )
 {
-    string description;
-    YDescribedItem * describedItem = dynamic_cast<YDescribedItem *>(item);
-
-    if ( describedItem )
-        description = describedItem->description();
-
-    createWidgets( item->label(),
-                   description,
-                   item->iconName(),
-                   item->selected() );
 }
 
 
@@ -296,6 +310,21 @@
 }
 
 
+void YQSelectorItemWidget::createWidgets()
+{
+    string description;
+    YDescribedItem * describedItem = dynamic_cast<YDescribedItem *>(_item);
+
+    if ( describedItem )
+        description = describedItem->description();
+
+    createWidgets( _item->label(),
+                   description,
+                   _item->iconName(),
+                   _item->selected() );
+}
+
+
 void YQSelectorItemWidget::createWidgets( const string  & label,
                                           const string & description,
                                           const string & iconName,
@@ -349,11 +378,7 @@
     // Heading (QRadioButton or QCheckBox)
     //
 
-    if ( singleSelection() )
-       _headingToggle = new QRadioButton( fromUTF8( label ), this );
-    else
-       _headingToggle = new QCheckBox( fromUTF8( label ), this );
-
+    _headingToggle = createHeadingToggle( label, this );
     YUI_CHECK_NEW( _headingToggle );
 
     _headingToggle->setObjectName( "YQSelectorItemHeading" );  // for QSS 
style sheets
@@ -363,9 +388,6 @@
     font.setBold( true );
     _headingToggle->setFont( font );
 
-    connect( _headingToggle,    &pclass( _headingToggle )::toggled,
-             this,              &pclass( this )::slotSelectionChanged );
-
     _vBox->addWidget( _headingToggle );
     _hBox->addLayout( _vBox );
 
@@ -379,17 +401,7 @@
        _descriptionLabel = new QLabel( fromUTF8( description ), this );
        YUI_CHECK_NEW( _descriptionLabel );
        _descriptionLabel->setObjectName( "YQSelectorItemDescription" ); // for 
QSS
-        _descriptionLabel->setIndent( ITEM_DESCRIPTION_INDENT ); // Compensate 
for QRadioButton icon
-
-        // That magic number in ITEM_DESCRIPTION_INDENT should really come from
-        // the widget style and some queries like
-        //
-        //   style()->pixelMetric( QStyle::PM_RadioButtonLabelSpacing );
-        //
-        // and then added up from all the necessary individual pieces. But most
-        // of those things are never clearly specified. In the Qt code itself
-        // there are gems like "width += 4" at strategic places. So there is no
-        // realistic way for us on this level to do that right.
+        _descriptionLabel->setIndent( itemDescriptionIndent() ); // Compensate 
for QRadioButton icon
 
         _vBox->addWidget( _descriptionLabel );
     }
@@ -425,6 +437,42 @@
 }
 
 
+QAbstractButton *
+YQSelectorItemWidget::createHeadingToggle( const std::string &  label,
+                                           QWidget *            parent )
+{
+    QAbstractButton * toggle = 0;
+
+    if ( singleSelection() )
+       toggle = new QRadioButton( fromUTF8( label ), this );
+    else
+       toggle = new QCheckBox( fromUTF8( label ), this );
+
+    YUI_CHECK_NEW( toggle );
+
+    connect( toggle,    &pclass( _headingToggle )::toggled,
+             this,      &pclass( this )::slotSelectionChanged );
+
+    return toggle;
+}
+
+
+int YQSelectorItemWidget::itemDescriptionIndent() const
+{
+    // This magic number in should really come from the widget style and some
+    // queries like
+    //
+    //   style()->pixelMetric( QStyle::PM_RadioButtonLabelSpacing );
+    //
+    // and then added up from all the necessary individual pieces. But most
+    // of those things are never clearly specified. In the Qt code itself
+    // there are gems like "width += 4" at strategic places. So there is no
+    // realistic way for us on this level to do that right.
+
+    return 20;
+}
+
+
 bool YQSelectorItemWidget::singleSelection() const
 {
     return _parent && _parent->enforceSingleSelection();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/src/YQItemSelector.h 
new/libyui-qt-2.51.3/src/YQItemSelector.h
--- old/libyui-qt-2.51.1/src/YQItemSelector.h   2019-09-24 15:48:30.000000000 
+0200
+++ new/libyui-qt-2.51.3/src/YQItemSelector.h   2019-11-07 12:11:15.000000000 
+0100
@@ -34,6 +34,7 @@
 class QScrollArea;
 class QHBoxLayout;
 class QVBoxLayout;
+class QButtonGroup;
 class QLabel;
 class YQSelectorItemWidget;
 
@@ -45,11 +46,13 @@
 public:
 
     /**
-     * Constructor.
+     * Standard constructor.
      **/
     YQItemSelector( YWidget *   parent,
                    bool         enforceSingleSelection = true );
 
+public:
+
     /**
      * Destructor.
      **/
@@ -128,7 +131,13 @@
     /**
      * Return the QWidget that will accept the item widgets.
      **/
-    QWidget * itemContainer() { return _itemContainer; }
+    QWidget * itemContainer() const { return _itemContainer; }
+
+    /**
+     * Return the QButtonGroup that manages exclusive buttons in single
+     * selection mode.
+     **/
+    QButtonGroup * buttonGroup() const { return _buttonGroup; }
 
     /**
      * Add an item widget to the appropriate layout.
@@ -151,6 +160,20 @@
 protected:
 
     /**
+     * Constructor for custom item status values. This is intended for derived
+     * classes; this class does not support custom item status values directly.
+     *
+     * See YItemSelector and YQCustomStatusItemSelector for more details.
+     **/
+    YQItemSelector( YWidget *                           parent,
+                    const YItemCustomStatusVector &     customStates );
+
+    /**
+     * Common initializations for all constructors.
+     **/
+    void init();
+
+    /**
      * Deselect all items except 'selectedItem'.
      **/
     void deselectOtherItems( YItem * selectedItem );
@@ -159,8 +182,9 @@
     // Data members
     //
 
-    QWidget    * _itemContainer;
-    QVBoxLayout * _itemLayout;
+    QWidget     * _itemContainer;
+    QButtonGroup * _buttonGroup;
+    QVBoxLayout  * _itemLayout;
 
     QMap<YItem *, YQSelectorItemWidget *> _itemWidgets;
 
@@ -188,15 +212,21 @@
     virtual ~YQSelectorItemWidget();
 
     /**
+     * Create the subwidgets. This needs to be called from the outside
+     * immediately after creating an instance of this class.
+     **/
+    virtual void createWidgets();
+
+    /**
      * Select the appropriate widget according to the parent's selection policy
      * (single or multi selection).
      **/
-    void setSelected( bool sel = true );
+    virtual void setSelected( bool sel = true );
 
     /**
      * Return 'true' if this item is selected, 'false' otherwise.
      **/
-    bool selected() const;
+    virtual bool selected() const;
 
     /**
      * Return 'true' if the parent YItemSelector has single selection (1-of-n).
@@ -236,10 +266,27 @@
 
 protected:
 
-    void createWidgets( const std::string      & label,
-                       const std::string       & description,
-                       const std::string       & iconName,
-                       bool                      selected = false );
+    virtual void createWidgets( const std::string      & label,
+                                const std::string      & description,
+                                const std::string      & iconName,
+                                bool                     selected = false );
+
+    /**
+     * Create the appropriate toggle button for this item and connect it to
+     * appropriate slots.
+     *
+     * This base class will create a QRadioButton or a QCheckBox, depending on
+     * the parent YQItemSelector's single or multi selection mode.
+     *
+     * Derived classes can overwrite this to create a different widget.
+     **/
+    virtual QAbstractButton * createHeadingToggle( const std::string &  label,
+                                                   QWidget *            parent 
);
+
+    /**
+     * Return the amount of indentation in pixels for the description text.
+     **/
+    virtual int itemDescriptionIndent() const;
 
     //
     // Data members
@@ -254,7 +301,7 @@
     QLabel             *     _descriptionLabel;
     QLabel             *   _iconLabel;
 
-};     // class YQSelectorItem
+};     // class YQSelectorItemWidget
 
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/src/YQWidgetFactory.cc 
new/libyui-qt-2.51.3/src/YQWidgetFactory.cc
--- old/libyui-qt-2.51.1/src/YQWidgetFactory.cc 2019-09-24 15:48:30.000000000 
+0200
+++ new/libyui-qt-2.51.3/src/YQWidgetFactory.cc 2019-11-07 12:11:15.000000000 
+0100
@@ -406,3 +406,14 @@
 
     return selector;
 }
+
+
+YQCustomStatusItemSelector *
+YQWidgetFactory::createCustomStatusItemSelector( YWidget * parent,
+                                                 const YItemCustomStatusVector 
& customStates )
+{
+    YQCustomStatusItemSelector * selector = new YQCustomStatusItemSelector( 
parent, customStates );
+    YUI_CHECK_NEW( selector );
+
+    return selector;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/src/YQWidgetFactory.h 
new/libyui-qt-2.51.3/src/YQWidgetFactory.h
--- old/libyui-qt-2.51.1/src/YQWidgetFactory.h  2019-09-24 15:48:30.000000000 
+0200
+++ new/libyui-qt-2.51.3/src/YQWidgetFactory.h  2019-11-07 12:11:15.000000000 
+0100
@@ -33,6 +33,7 @@
 #include "YQCheckBox.h"
 #include "YQCheckBoxFrame.h"
 #include "YQComboBox.h"
+#include "YQCustomStatusItemSelector.h"
 #include "YQDialog.h"
 #include "YQEmpty.h"
 #include "YQFrame.h"
@@ -145,7 +146,8 @@
     // More leaf widgets (moved to the end to maintain ABI compatibility)
     //
 
-    virtual YQItemSelector *     createItemSelector      ( YWidget * parent, 
bool enforceSingleSelection = true );
+    virtual YQItemSelector *             createItemSelector             ( 
YWidget * parent, bool enforceSingleSelection = true );
+    virtual YQCustomStatusItemSelector * createCustomStatusItemSelector ( 
YWidget * parent, const YItemCustomStatusVector & customStates );
 
 
 protected:
Binary files old/libyui-qt-2.51.1/src/icons/checkbox-auto-selected.png and 
new/libyui-qt-2.51.3/src/icons/checkbox-auto-selected.png differ
Binary files old/libyui-qt-2.51.1/src/icons/checkbox-off.png and 
new/libyui-qt-2.51.3/src/icons/checkbox-off.png differ
Binary files old/libyui-qt-2.51.1/src/icons/checkbox-on.png and 
new/libyui-qt-2.51.3/src/icons/checkbox-on.png differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-qt-2.51.1/src/qt_icons.qrc 
new/libyui-qt-2.51.3/src/qt_icons.qrc
--- old/libyui-qt-2.51.1/src/qt_icons.qrc       2019-09-24 15:48:30.000000000 
+0200
+++ new/libyui-qt-2.51.3/src/qt_icons.qrc       2019-11-07 12:11:15.000000000 
+0100
@@ -1,6 +1,9 @@
 <!DOCTYPE RCC>
 <RCC version="1.0">
        <qresource>
+               <file alias="checkbox-off">icons/checkbox-off.png</file>
+               <file alias="checkbox-on">icons/checkbox-on.png</file>
+               <file 
alias="checkbox-auto-selected">icons/checkbox-auto-selected.png</file>
                <file alias="computer">icons/computer.svg</file>
                <file alias="configure">icons/configure.svg</file>
                <file alias="dialog-error">icons/dialog-error.svg</file>


Reply via email to