#include "ColorCache.h"
#include "GuiApplication.h"
+#include "GuiDialog.h"
#include "Validator.h"
#include "qt_helpers.h"
#include <QPixmap>
#include <QIcon>
#include <QColor>
-#include <QColorDialog>
#ifdef KeyPress
#undef KeyPress
else
guiApp->getRgbColor(lcolor.getFromLyXName(bcolor), rgbcol);
QColor const initial = rgb2qcolor(rgbcol);
- QColor ncol = QColorDialog::getColor(initial, qApp->focusWidget());
+ QColor ncol = GuiDialog::getColor(initial, this);
if (!ncol.isValid())
return;
#include <QCloseEvent>
#include <QDialogButtonBox>
+#include <QColorDialog>
using namespace std;
}
+QColor GuiDialog::getColor(const QColor &initial, QWidget *parent)
+{
+ const QColor color = QColorDialog::getColor(initial, parent);
+ if (guiApp->platformName() == "cocoa") {
+ QWidget * dialog = parent->window();
+ // On Mac explicitly activate the parents top-level widget
+ // See #10740
+ dialog->raise();
+ dialog->activateWindow();
+ }
+ return color;
+}
+
+QColor GuiDialog::getColor(const QColor &initial)
+{
+ return getColor(initial, asQWidget());
+}
+
} // namespace frontend
} // namespace lyx
QString const & label2 = QString(),
QString const & dir2 = QString());
+ static QColor getColor(const QColor &initial, QWidget *parent);
+ QColor getColor(const QColor &initial);
+
private:
ButtonController bc_;
/// are we updating ?
#include <QAbstractItemModel>
#include <QButtonGroup>
#include <QColor>
-#include <QColorDialog>
#include <QCloseEvent>
#include <QDirIterator>
#include <QFontDatabase>
void GuiDocument::changeBackgroundColor()
{
- QColor const & newColor = QColorDialog::getColor(
- rgb2qcolor(set_backgroundcolor), asQWidget());
+ QColor const & newColor = getColor(rgb2qcolor(set_backgroundcolor));
if (!newColor.isValid())
return;
// set the color
void GuiDocument::changeFontColor()
{
- QColor const & newColor = QColorDialog::getColor(
- rgb2qcolor(set_fontcolor), asQWidget());
+ QColor const & newColor = getColor(rgb2qcolor(set_fontcolor));
if (!newColor.isValid())
return;
// set the color
void GuiDocument::changeNoteFontColor()
{
- QColor const & newColor = QColorDialog::getColor(
- rgb2qcolor(set_notefontcolor), asQWidget());
+ QColor const & newColor = getColor(rgb2qcolor(set_notefontcolor));
if (!newColor.isValid())
return;
// set the color
void GuiDocument::changeBoxBackgroundColor()
{
- QColor const & newColor = QColorDialog::getColor(
- rgb2qcolor(set_boxbgcolor), asQWidget());
+ QColor const & newColor = getColor(rgb2qcolor(set_boxbgcolor));
if (!newColor.isValid())
return;
// set the color
#include "ColorCache.h"
#include "GuiApplication.h"
+#include "GuiDialog.h"
#include "Validator.h"
#include "qt_helpers.h"
#include <QPixmap>
#include <QIcon>
#include <QColor>
-#include <QColorDialog>
using namespace std;
return;
QColor const initial = rgb2qcolor(index->color());
- QColor ncol = QColorDialog::getColor(initial, qApp->focusWidget());
+ QColor ncol = GuiDialog::getColor(initial, this);
if (!ncol.isValid())
return;
#include <QAbstractItemModel>
#include <QCheckBox>
-#include <QColorDialog>
#include <QFontDatabase>
#include <QHeaderView>
#include <QLineEdit>
return;
QString const color = newcolors_[size_t(row)];
- QColor const c = QColorDialog::getColor(QColor(color), qApp->focusWidget());
+ QColor const c = form_->getColor(QColor(color));
if (setColor(row, c, color)) {
setDisabledResets();