freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] gsoc-2022-chariri-2 8c2aa6c 09/30: [ftinspect] Remove


From: Werner Lemberg
Subject: [freetype2-demos] gsoc-2022-chariri-2 8c2aa6c 09/30: [ftinspect] Remove `QComboBoxx`
Date: Mon, 11 Jul 2022 07:17:38 -0400 (EDT)

branch: gsoc-2022-chariri-2
commit 8c2aa6c86d4e43932de6227436e6d1962e95abc9
Author: Charlie Jiang <w@chariri.moe>
Commit: Charlie Jiang <w@chariri.moe>

    [ftinspect] Remove `QComboBoxx`
    
    We no longer need a custom `QComboBox` for disabling individual items in the
    combo box. Our custom `QAbstractListModel` has done this already.
    
    * src/ftinspect/widgets/custom_widgets.cpp,
      src/ftinspect/widgets/custom_widgets.hpp: Remove `QComboBoxx`.
---
 src/ftinspect/widgets/custom_widgets.cpp | 29 -----------------------------
 src/ftinspect/widgets/custom_widgets.hpp | 13 -------------
 2 files changed, 42 deletions(-)

diff --git a/src/ftinspect/widgets/custom_widgets.cpp 
b/src/ftinspect/widgets/custom_widgets.cpp
index bdbf9c1..15ed26f 100644
--- a/src/ftinspect/widgets/custom_widgets.cpp
+++ b/src/ftinspect/widgets/custom_widgets.cpp
@@ -8,35 +8,6 @@
 #include <QScrollBar>
 #include <QStyleOptionButton>
 
-// ----------------------------
-// >>>>>>>> QComboBoxx <<<<<<<<
-// ----------------------------
-
-void
-QComboBoxx::setItemEnabled(int index,
-                           bool enable)
-{
-  const QStandardItemModel* itemModel =
-    qobject_cast<const QStandardItemModel*>(model());
-  QStandardItem* item = itemModel->item(index);
-
-  if (enable)
-  {
-    item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-    item->setData(QVariant(),
-                  Qt::TextColorRole);
-  }
-  else
-  {
-    item->setFlags(item->flags()
-                   & ~(Qt::ItemIsSelectable | Qt::ItemIsEnabled));
-    // clear item data in order to use default color;
-    // this visually greys out the item
-    item->setData(palette().color(QPalette::Disabled, QPalette::Text),
-                  Qt::TextColorRole);
-  }
-}
-
 // --------------------------------
 // >>>>>>>> QGraphicsViewx <<<<<<<<
 // --------------------------------
diff --git a/src/ftinspect/widgets/custom_widgets.hpp 
b/src/ftinspect/widgets/custom_widgets.hpp
index 34c1b34..bbe1d28 100644
--- a/src/ftinspect/widgets/custom_widgets.hpp
+++ b/src/ftinspect/widgets/custom_widgets.hpp
@@ -16,19 +16,6 @@
 // Because all those derived classes are pretty tiny and not core logic, 
they're
 // organized into one single hpp/cpp pair.
 
-// we want to grey out items in a combo box;
-// since Qt doesn't provide a function for this we derive a class
-class QComboBoxx
-: public QComboBox
-{
-  Q_OBJECT
-
-public:
-  void setItemEnabled(int index,
-                      bool enable);
-};
-
-
 // we want to anchor the view at the bottom left corner
 // while the windows gets resized
 class QGraphicsViewx



reply via email to

[Prev in Thread] Current Thread [Next in Thread]