Read compile warnins please. Fix color picker

This commit is contained in:
ArsenArsen 2017-07-03 12:07:49 +02:00
parent 363c817cfb
commit bb6b41f762
3 changed files with 7 additions and 6 deletions

View File

@ -15,6 +15,9 @@ ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget)
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::HighQualityAntialiasing); setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::HighQualityAntialiasing);
setCursor(QCursor(Qt::CrossCursor)); setCursor(QCursor(Qt::CrossCursor));
setMouseTracking(true); setMouseTracking(true);
setWindowTitle("KShare Color Picker");
setGeometry(pixmap.rect());
setAttribute(Qt::WA_DeleteOnClose);
pItem = addPixmap(pixmap); pItem = addPixmap(pixmap);
pItem->setZValue(-2); pItem->setZValue(-2);
@ -29,6 +32,8 @@ ColorPickerScene::ColorPickerScene(QPixmap pixmap, QWidget *parentWidget)
color = pItem->pixmap().toImage().pixelColor(QCursor::pos()); color = pItem->pixmap().toImage().pixelColor(QCursor::pos());
text->setPlainText(color.name()); text->setPlainText(color.name());
ellipse->setBrush(color); ellipse->setBrush(color);
show();
} }
void ColorPickerScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { void ColorPickerScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {

View File

@ -17,12 +17,7 @@ public:
void keyPressEvent(QKeyEvent *event) override; void keyPressEvent(QKeyEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override; void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override;
static void showPicker() { static void showPicker() {
ColorPickerScene *s = new ColorPickerScene(screenshotutil::fullscreen(), 0); ColorPickerScene(screenshotutil::fullscreen(), 0);
QTimer::singleShot(0, [s] {
s->showFullScreen();
QScopedPointer<ColorPickerScene>(s);
// Before anyone asks I have 0 clue about how does this not segfault
});
} }
private: private:

View File

@ -26,6 +26,7 @@ UploaderSingleton::UploaderSingleton() : QObject() {
qFatal("Cannot determine location of your home directory"); qFatal("Cannot determine location of your home directory");
} }
saveDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Screenshots"; saveDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/Screenshots";
break;
default: default:
qFatal("Invalid config [saveLocation not int or is not in range]"); qFatal("Invalid config [saveLocation not int or is not in range]");
break; break;