reapply image scaling
This commit is contained in:
parent
8b80bf11d9
commit
1381ceda53
@ -77,7 +77,8 @@ PylonRecorder::PylonRecorder(QWidget *parent)
|
|||||||
//grabbingLabel->setStyleSheet("QLabel { color : gray; }");
|
//grabbingLabel->setStyleSheet("QLabel { color : gray; }");
|
||||||
grabbingLabel->setEnabled(false);
|
grabbingLabel->setEnabled(false);
|
||||||
labelSwitch = false;
|
labelSwitch = false;
|
||||||
cameraConnectedLabel = new QLabel("disconnected");
|
cameraConnectedLabel = new QLabel("not connected");
|
||||||
|
cameraConnectedLabel->setStyleSheet("QLabel { color : red; }");
|
||||||
|
|
||||||
statusBar()->addWidget(new QLabel("Camera:"));
|
statusBar()->addWidget(new QLabel("Camera:"));
|
||||||
statusBar()->addWidget(cameraConnectedLabel);
|
statusBar()->addWidget(cameraConnectedLabel);
|
||||||
@ -124,15 +125,17 @@ void PylonRecorder::setImage(const QImage &newImage) {
|
|||||||
// (image.colorSpace().isValid())
|
// (image.colorSpace().isValid())
|
||||||
// image.convertToColorSpace(QColorSpace::SRgb);
|
// image.convertToColorSpace(QColorSpace::SRgb);
|
||||||
imageLabel->setPixmap(QPixmap::fromImage(image));
|
imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||||
scaleFactor = 1.0;
|
// scaleFactor = 1.0;
|
||||||
|
|
||||||
scrollArea->setVisible(true);
|
scrollArea->setVisible(true);
|
||||||
printAct->setEnabled(true);
|
printAct->setEnabled(true);
|
||||||
fitToWindowAct->setEnabled(true);
|
fitToWindowAct->setEnabled(true);
|
||||||
updateActions();
|
updateActions();
|
||||||
|
|
||||||
if (!fitToWindowAct->isChecked())
|
if (!fitToWindowAct->isChecked()) {
|
||||||
imageLabel->adjustSize();
|
imageLabel->adjustSize();
|
||||||
|
applyScaling();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PylonRecorder::saveFile(const QString &fileName) {
|
bool PylonRecorder::saveFile(const QString &fileName) {
|
||||||
@ -382,6 +385,10 @@ void PylonRecorder::scaleImage(double factor) {
|
|||||||
zoomOutAct->setEnabled(scaleFactor > 0.333);
|
zoomOutAct->setEnabled(scaleFactor > 0.333);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PylonRecorder::applyScaling(){
|
||||||
|
imageLabel->resize(scaleFactor * imageLabel->pixmap()->size());
|
||||||
|
}
|
||||||
|
|
||||||
void PylonRecorder::quitApplication() {
|
void PylonRecorder::quitApplication() {
|
||||||
if (pylon->isOpen()) {
|
if (pylon->isOpen()) {
|
||||||
if (grabbing) {
|
if (grabbing) {
|
||||||
@ -411,8 +418,8 @@ void PylonRecorder::connectCamera() {
|
|||||||
void PylonRecorder::disconnectCamera() {
|
void PylonRecorder::disconnectCamera() {
|
||||||
pylon->closeCamera();
|
pylon->closeCamera();
|
||||||
statusBar()->showMessage(tr("Camera closed!"));
|
statusBar()->showMessage(tr("Camera closed!"));
|
||||||
cameraConnectedLabel->setText("disconnected");
|
cameraConnectedLabel->setText("not connected");
|
||||||
cameraConnectedLabel->setStyleSheet("QLabel { color : black; }");
|
cameraConnectedLabel->setStyleSheet("QLabel { color : red; }");
|
||||||
updateActions();
|
updateActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,6 +476,7 @@ void PylonRecorder::displayActivity() {
|
|||||||
writingLabel->setEnabled(labelSwitch && writing);
|
writingLabel->setEnabled(labelSwitch && writing);
|
||||||
labelSwitch = !labelSwitch;
|
labelSwitch = !labelSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PylonRecorder::displaySingleFrame() {
|
void PylonRecorder::displaySingleFrame() {
|
||||||
MyImage img;
|
MyImage img;
|
||||||
bool valid = buffer->readLast(img);
|
bool valid = buffer->readLast(img);
|
||||||
|
@ -69,6 +69,7 @@ private:
|
|||||||
bool saveFile(const QString &fileName);
|
bool saveFile(const QString &fileName);
|
||||||
void setImage(const QImage &newImage);
|
void setImage(const QImage &newImage);
|
||||||
void scaleImage(double factor);
|
void scaleImage(double factor);
|
||||||
|
void applyScaling();
|
||||||
void adjustScrollBar(QScrollBar *scrollBar, double factor);
|
void adjustScrollBar(QScrollBar *scrollBar, double factor);
|
||||||
|
|
||||||
QImage image;
|
QImage image;
|
||||||
|
Loading…
Reference in New Issue
Block a user