[neon/backports-noble/kcolorpicker-noble/Neon/unstable] /: New upstream version 0.1.6
Boyuan Yang
null at kde.org
Wed Jul 3 15:10:15 BST 2024
Git commit 4ae48899104a6c8fc649bb659bb9007753c56a05 by Boyuan Yang.
Committed on 15/08/2021 at 15:45.
Pushed by jriddell into branch 'Neon/unstable'.
New upstream version 0.1.6
M +1 -1 CMakeLists.txt
M +1 -1 README.md
M +9 -8 src/PopupMenu.cpp
M +2 -2 src/PopupMenu.h
https://invent.kde.org/neon/backports-noble/kcolorpicker-noble/-/commit/4ae48899104a6c8fc649bb659bb9007753c56a05
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14a1bfc..f78a5a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
-project(kColorPicker LANGUAGES CXX VERSION 0.1.5)
+project(kColorPicker LANGUAGES CXX VERSION 0.1.6)
set(QT_MIN_VERSION "5.9.4")
diff --git a/README.md b/README.md
index 64371f8..6d06c4b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# kColorPicker [![Build Status](https://travis-ci.org/ksnip/kColorPicker.svg?branch=master)](https://travis-ci.org/ksnip/kColorPicker)
QToolButton with color popup menu with lets you select a color. The popup features a color dialog button which can be used to add custom colors to the popup menu.
-Version 0.1.5
+Version 0.1.6
![kColorPicker](https://i.imgur.com/VkhUvFa.png "kColorPicker")
diff --git a/src/PopupMenu.cpp b/src/PopupMenu.cpp
index e8f6675..d279bfa 100644
--- a/src/PopupMenu.cpp
+++ b/src/PopupMenu.cpp
@@ -21,14 +21,17 @@
namespace kColorPicker {
-PopupMenu::PopupMenu()
+PopupMenu::PopupMenu() :
+ mButtonGroup(new QButtonGroup()),
+ mLayout(new QGridLayout()),
+ mColorDialogButton(new ColorDialogButton(QIcon(QLatin1String(":/icons/ellipsis"))))
{
- mButtonGroup = new QButtonGroup();
- mLayout = new QGridLayout();
+
mLayout->setSpacing(0);
mLayout->setMargin(5);
setLayout(mLayout);
- addColorDialogButton();
+
+ connect(mColorDialogButton, &AbstractPopupMenuButton::colorSelected, this, &PopupMenu::colorSelected);
}
PopupMenu::~PopupMenu()
@@ -114,11 +117,9 @@ void PopupMenu::colorSelected(const QColor &color)
hide();
}
-void PopupMenu::addColorDialogButton()
+QSize PopupMenu::sizeHint() const
{
- auto icon = QIcon(QLatin1String(":/icons/ellipsis"));
- mColorDialogButton = new ColorDialogButton(icon);
- connect(mColorDialogButton, &AbstractPopupMenuButton::colorSelected, this, &PopupMenu::colorSelected);
+ return mLayout->sizeHint();
}
} // namespace kColorPicker
\ No newline at end of file
diff --git a/src/PopupMenu.h b/src/PopupMenu.h
index a7af81a..1171e40 100644
--- a/src/PopupMenu.h
+++ b/src/PopupMenu.h
@@ -38,6 +38,7 @@ public:
~PopupMenu() override;
void addColor(const QColor &color);
void selectColor(const QColor &color);
+ QSize sizeHint() const;
signals:
void colorChanged(const QColor &color) const;
@@ -49,9 +50,8 @@ private:
ColorDialogButton *mColorDialogButton;
void generateGrid();
- ColorButton *createButton(const QColor &color);
+ static ColorButton *createButton(const QColor &color);
void addColorButton(const QColor &color);
- void addColorDialogButton();
void clearGrid();
bool isColorInGrid(const QColor &color);
More information about the Neon-commits
mailing list