Better status bar
This commit is contained in:
@@ -36,6 +36,7 @@ set(TENMON_SRC
|
|||||||
markedfiles.cpp
|
markedfiles.cpp
|
||||||
rawimage.cpp
|
rawimage.cpp
|
||||||
starfit.cpp
|
starfit.cpp
|
||||||
|
statusbar.cpp
|
||||||
stfslider.cpp
|
stfslider.cpp
|
||||||
stretchtoolbar.cpp
|
stretchtoolbar.cpp
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -471,9 +471,9 @@ void ImageWidget::mouseMoveEvent(QMouseEvent *event)
|
|||||||
if(m_rawImage->pixel(pix.x(), pix.y(), rgb))
|
if(m_rawImage->pixel(pix.x(), pix.y(), rgb))
|
||||||
{
|
{
|
||||||
if(m_bwImg)
|
if(m_bwImg)
|
||||||
emit status(tr("L:%1 %2 X:%3 Y:%4").arg(rgb.x()).arg(sky.toString()).arg((int)pix.x()).arg((int)pix.y()));
|
emit status(tr("L:%1").arg(rgb.x()), tr("X:%3 Y:%4").arg((int)pix.x()).arg((int)pix.y()), sky.toString());
|
||||||
else
|
else
|
||||||
emit status(tr("R:%1 G:%2 B:%3 %4 X:%5 Y:%6").arg(rgb.x()).arg(rgb.y()).arg(rgb.z()).arg(sky.toString()).arg((int)pix.x()).arg((int)pix.y()));
|
emit status(tr("R:%1 G:%2 B:%3").arg(rgb.x()).arg(rgb.y()).arg(rgb.z()), tr("X:%3 Y:%4").arg((int)pix.x()).arg((int)pix.y()), sky.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ protected:
|
|||||||
void thumbSelect(QMouseEvent *event);
|
void thumbSelect(QMouseEvent *event);
|
||||||
signals:
|
signals:
|
||||||
void fileDropped(const QString &path);
|
void fileDropped(const QString &path);
|
||||||
void status(const QString &status);
|
void status(const QString &value, const QString &pixelCoords, const QString &celestialCoords);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ImageScrollAreaGL : public QWidget
|
class ImageScrollAreaGL : public QWidget
|
||||||
|
|||||||
+4
-1
@@ -19,6 +19,7 @@
|
|||||||
#include "loadrunable.h"
|
#include "loadrunable.h"
|
||||||
#include "markedfiles.h"
|
#include "markedfiles.h"
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@@ -48,7 +49,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
m_imageGL = new ImageScrollAreaGL(m_database, this);
|
m_imageGL = new ImageScrollAreaGL(m_database, this);
|
||||||
setCentralWidget(m_imageGL);
|
setCentralWidget(m_imageGL);
|
||||||
|
|
||||||
connect(m_imageGL->imageWidget(), &ImageWidget::status, [this](const QString &status){ statusBar()->showMessage(status); });
|
StatusBar *statusBar = new StatusBar(this);
|
||||||
|
setStatusBar(statusBar);
|
||||||
|
connect(m_imageGL->imageWidget(), &ImageWidget::status, statusBar, &StatusBar::newStatus);
|
||||||
|
|
||||||
m_stretchPanel = new StretchToolbar(this);
|
m_stretchPanel = new StretchToolbar(this);
|
||||||
connect(m_stretchPanel, SIGNAL(paramChanged(float,float,float)), m_imageGL->imageWidget(), SLOT(setMTFParams(float,float,float)));
|
connect(m_stretchPanel, SIGNAL(paramChanged(float,float,float)), m_imageGL->imageWidget(), SLOT(setMTFParams(float,float,float)));
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include "statusbar.h"
|
||||||
|
#include <QFontMetrics>
|
||||||
|
|
||||||
|
StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent)
|
||||||
|
{
|
||||||
|
m_value = new QLabel(this);
|
||||||
|
m_pixelCoords = new QLabel(this);
|
||||||
|
m_celestianCoords = new QLabel(this);
|
||||||
|
|
||||||
|
m_value->setMinimumWidth(m_value->fontMetrics().horizontalAdvance("R:65536 G:65536 B:65536 "));
|
||||||
|
m_pixelCoords->setMinimumWidth(m_pixelCoords->fontMetrics().horizontalAdvance("X:65536 Y:65536 "));
|
||||||
|
m_celestianCoords->setMinimumWidth(m_celestianCoords->fontMetrics().horizontalAdvance("RA: 00h00m00s DEC: 00° 00' 00\" "));
|
||||||
|
addPermanentWidget(m_value);
|
||||||
|
addPermanentWidget(m_pixelCoords);
|
||||||
|
addPermanentWidget(m_celestianCoords);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusBar::newStatus(const QString &value, const QString &pixelCoords, const QString &celestialCoords)
|
||||||
|
{
|
||||||
|
m_value->setText(value);
|
||||||
|
m_pixelCoords->setText(pixelCoords);
|
||||||
|
m_celestianCoords->setText(celestialCoords);
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef STATUSBAR_H
|
||||||
|
#define STATUSBAR_H
|
||||||
|
|
||||||
|
#include <QStatusBar>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
class StatusBar : public QStatusBar
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QLabel *m_value;
|
||||||
|
QLabel *m_pixelCoords;
|
||||||
|
QLabel *m_celestianCoords;
|
||||||
|
public:
|
||||||
|
explicit StatusBar(QWidget *parent = nullptr);
|
||||||
|
public slots:
|
||||||
|
void newStatus(const QString &value, const QString &pixelCoords, const QString &celestialCoords);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // STATUSBAR_H
|
||||||
Reference in New Issue
Block a user