diff --git a/src/ColorPicker/ColorPickerHost.cxx b/src/ColorPicker/ColorPickerHost.cxx index 64b27e1..f6cd863 100644 --- a/src/ColorPicker/ColorPickerHost.cxx +++ b/src/ColorPicker/ColorPickerHost.cxx @@ -10,8 +10,12 @@ const QImage& GetPictureSurroundedCurrentCursor() } ColorPickerCanvas::ColorPickerCanvas() - // :QWidget(nullptr, Qt::Tool) +#ifdef Q_OS_WIN + :QWidget(nullptr, Qt::Tool) +#endif +#ifdef Q_OS_MAC :QWidget(nullptr) +#endif // ,m_pixmap_circle_mask_x1(QPixmap(":/Res/CircleMask")) ,m_pixmap_circle_mask_x2(QPixmap(":/Res/CircleMask@2")) @@ -311,6 +315,9 @@ ColorPickerHost::traceMouseButtonDown(const int x, const int y, const int mask) return; } // qDebug() << __CURRENT_FUNCTION_NAME__; +#ifdef Q_OS_MAC + onMousePickedEvent(); +#endif // Q_OS_MAC } void @@ -320,7 +327,21 @@ ColorPickerHost::traceMouseButtonUp(const int x, const int y, const int mask) return; } // qDebug() << __CURRENT_FUNCTION_NAME__; +#ifdef Q_OS_WIN + onMousePickedEvent(); +#endif // Q_OS_WIN +} +void +ColorPickerHost::GetFired(int value) +{ + // qDebug() << __CURRENT_FUNCTION_NAME__ << value; + ColorPickerHost::SetColorPickerVisible(); +} + +void +ColorPickerHost::onMousePickedEvent() +{ //qDebug() << currentColor().name().toUpper(); printf("%s\n", currentColor().name().toUpper().toStdString().c_str()); fflush(stdout); @@ -332,11 +353,4 @@ ColorPickerHost::traceMouseButtonUp(const int x, const int y, const int mask) m_color_picker_canvas->close(); qGuiApp->exit(0); -} - -void -ColorPickerHost::GetFired(int value) -{ - // qDebug() << __CURRENT_FUNCTION_NAME__ << value; - ColorPickerHost::SetColorPickerVisible(); -} +} \ No newline at end of file diff --git a/src/ColorPicker/ColorPickerHost.hxx b/src/ColorPicker/ColorPickerHost.hxx index 1e7b45d..d058388 100644 --- a/src/ColorPicker/ColorPickerHost.hxx +++ b/src/ColorPicker/ColorPickerHost.hxx @@ -111,6 +111,8 @@ private: void traceMouseMove(const int x, const int y); void traceMouseButtonDown(const int x, const int y, const int mask); void traceMouseButtonUp(const int x, const int y, const int mask); +private: + void onMousePickedEvent(); private Q_SLOTS: void GetFired(int value); };