PDA

View Full Version : Image processing error



bachkimfly
5th October 2013, 18:42
Hi everyone. I have a problem, I'm creating a simple Image Processing app, at part of brightness adjustment i can't run this function, when it's called then app will be crashed. I have two forms, one of form is mainwindow, one else is sub form to adjust brightness.



//mainwindow.cpp

void MainWindow::brightnessProcessing(int value)
{
QImage image = imageLabel->pixmap()->toImage();
int w = image.width();
int h = image.height();
QColor c;
int r, g, b;
for(int i=0; i<h; i++)
for(int j=0; j<w; j++) {
c = image.pixel(i, j);
r = c.red()+value;
g = c.green()+value;
b = c.blue()+value;
image.setPixel(i, j, qRgb(r, g, b));
}
imageLabel->setPixmap(QPixmap::fromImage(image));
}




//mainwindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtWidgets>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void brightnessProcessing(int value);

private slots:
..........

private:
Ui::MainWindow *ui;
QImage *image;
QLabel *imageLabel;
QScrollArea *scrollArea;
QScrollBar *scrollBar;
double scaleFactor;

void scaleImage(double factor);
void adjustScrollBar(QScrollBar *scrollBar, double factor);
};

#endif // MAINWINDOW_H




//brightnesscontrast.cpp

void BrightnessContrast::on_horizontalSliderBrightness_ valueChanged(int value)
{
ui->lineEditBrightness->setText(QString::number(value));
respond.brightnessProcessing(value);
}




//brightnesscontrast.h

#ifndef BRIGHTNESSCONTRAST_H
#define BRIGHTNESSCONTRAST_H

#include <QDialog>
#include <QtWidgets>
#include "mainwindow.h"

namespace Ui {
class BrightnessContrast;
}

class BrightnessContrast : public QDialog
{
Q_OBJECT

public:
explicit BrightnessContrast(QWidget *parent = 0);
~BrightnessContrast();

private slots:
void on_horizontalSliderBrightness_valueChanged(int value);

void on_horizontalSliderContrast_valueChanged(int value);

private:
Ui::BrightnessContrast *ui;
MainWindow respond;
};

#endif // BRIGHTNESSCONTRAST_H



anyhelp!

ChrisW67
5th October 2013, 22:17
Run your program in your debugger and determine where your program crashes. Then work the conditions that cause it to crash there.

Having an instance of the MainWindow in your dialog as a member variable is unusual.
What happens when the existing red, green, or blue value is 255?

bachkimfly
6th October 2013, 07:34
I have run my program in debugger, have identified where my program crashes but i don't understand error parameters means what. So can't fix to error
it here


http://i.upanh.com/riildt

i also have edited member variables


r = qBound<int>(0, c.red() + value, 255);
g = qBound<int>(0, c.green() + value, 255);
b = qBound<int>(0, c.blue() + value, 255);

anda_skoa
6th October 2013, 09:54
I have run my program in debugger, have identified where my program crashes but i don't understand error parameters means what. So can't fix to error
it here

And since you don't tell us the error we can't help you either.

Is imageLabel a valid pointer?

Cheers,
_

bachkimfly
6th October 2013, 10:52
And since you don't tell us the error we can't help you either.

Is imageLabel a valid pointer?

Cheers,
_

Actually, I can't determine correct error, if that be can then I used quick search in net. I have run debugger and output above, hope it is useful.
Yes, imageLabel is a valid pointer!

wysota
6th October 2013, 15:14
Post the backtrace.

bachkimfly
6th October 2013, 16:21
backtrace for 4 breakpoints here:


#2 0x0000000000406a40 in MainWindow::brightnessProcessing (this=0x7fffffffc838, value=1) at ../../qt workspace/Auroras/mainwindow.cpp:161
image = <incomplete type>
w = 32767
c = {cspec = 4294952960, ct = {argb = {alpha = 32767, red = 0, green = 49696, blue = 196, pad = 0}, ahsv = {alpha = 32767, hue = 0, saturation = 49696, value = 196, pad = 0}, acmyk = {alpha = 32767, cyan = 0, magenta = 49696, yellow = 196, black = 0}, ahsl = {alpha = 32767, hue = 0, saturation = 49696, lightness = 196, pad = 0}, array = {32767, 0, 49696, 196, 0}}}
g = 4232186
h = -20672
r = 32767
b = 0
#3 0x000000000040973c in BrightnessContrast::on_horizontalSliderBrightness_ valueChanged (this=0x7fffffffc800, value=1) at ../../qt workspace/Auroras/brightnesscontrast.cpp:19
No locals.
#4 0x000000000040a5c5 in BrightnessContrast::qt_static_metacall (_o=0x7fffffffc800, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffb1c0) at moc_brightnesscontrast.cpp:73
_t = 0x7fffffffc800
#5 0x000000000040a6da in BrightnessContrast::qt_metacall (this=0x7fffffffc800, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffb1c0) at moc_brightnesscontrast.cpp:106
No locals.

wysota
6th October 2013, 16:55
Seems like BrightnessContrast instance is an invalid pointer.

bachkimfly
6th October 2013, 17:39
I import mainwindow into BrightnessContrast and declare:


MainWindow respond;
respond.brightnessProcessing(value);

This right?

bachkimfly
6th October 2013, 21:24
I posted backtrace wrong, I editted in #7

wysota
6th October 2013, 21:30
Could you explain why you did the thing Chris pointed out a couple of posts ago -- made MainWindow a member variable of a QDialog subclass?

bachkimfly
6th October 2013, 21:43
Can you give me a few link? I not yet reat it.
------------------------------------

I'm trying "made MainWindow a member variable of a QDialog subclass"

wysota
6th October 2013, 22:43
I'm trying "made MainWindow a member variable of a QDialog subclass"

Yes, we can see that. But why are you trying to do this?

bachkimfly
6th October 2013, 23:00
If don't made MainWindow a member variable of a QDialog, how to can executable event in QDialog. So what is your idea?

wysota
6th October 2013, 23:08
If don't made MainWindow a member variable of a QDialog, how to can executable event in QDialog.

I don't understand what you mean.

bachkimfly
6th October 2013, 23:22
I want to catch event slider value changed, but brightness processing function which at MainWindow, if don't made MainWindow as a member variable of a BrightnessContrast dialog, i dont know to executable event slider value changed. your idea!

P/s: now, it's 5:22 AM, a tonight don't sleep, i want to go to sleep

wysota
7th October 2013, 05:50
I want to catch event slider value changed, but brightness processing function which at MainWindow, if don't made MainWindow as a member variable of a BrightnessContrast dialog, i dont know to executable event slider value changed. your idea!

Don't you already have an instance of the main window which launched the dialog? Do you understand the difference between a class and an instance of a class?

bachkimfly
7th October 2013, 06:13
Alright! I need have to initialize object of MainWindow class, right?. I asked in #9.
So what is I can understand for "made MainWindow a member variable of a QDialog subclass". Patently, I misconstrued.

wysota
7th October 2013, 06:41
Alright! I need have to initialize object of MainWindow class, right?

No, I'm assuming you already have such an object somewhere.

Let's make a deal - if you keep ignoring my questions, I will start ignoring yours.

bachkimfly
7th October 2013, 14:12
No, I'm assuming you already have such an object somewhere.

Let's make a deal - if you keep ignoring my questions, I will start ignoring yours.

I don't ignore, I answered by the question "I need have to initialize object of MainWindow class, right?". That means I don't have an instance of the main window which launched the dialog and I understand the difference between a class and an instance of a class. I think so.

But I feel we are going around.

wysota
7th October 2013, 14:57
Did you initialize the imageLabel pointer with a QLabel instance? Can you show us the code where you did that?

bachkimfly
7th October 2013, 20:52
I did.


MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);

imageLabel = new QLabel;
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
imageLabel->setScaledContents(true);

scrollArea = new QScrollArea;
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(imageLabel);
setCentralWidget(scrollArea);
statusBar()->addWidget(ui->frame, 9);
statusBar()->addWidget(ui->spinBoxZoom, 1);
ui->frame->setFocus();
//ui->mainToolBar->setStyleSheet("QToolBar{background-color: rgb(60,60,60);}");
ui->mainToolBar->setBackgroundRole(QPalette::Window);
}

wysota
8th October 2013, 06:02
I noticed now that the back trace you posted is missing two first frames. Can you post the complete backtrace?

bachkimfly
8th October 2013, 08:10
Yes, missing 2 first frames. That time I only post backtrace for 4 breakpoints. Now, I edited source code, I have to back to previous code to have full backtrace.
I want to ask that how to invoke brightness processing when slider value changed in Dialog.

wysota
8th October 2013, 09:10
I don't need your breakpoints. When the program crashes, print the backtrace from the debugger and post it here.

bachkimfly
8th October 2013, 13:39
backtrace it's below.



Thread 10 (Thread 0x7fffdf131700 (LWP 3430)):
#0 0x00007ffff5de105e in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#1 0x00007ffff5912935 in g_cond_wait_until () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#2 0x00007ffff58a8b81 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#3 0x00007ffff58a91ca in g_async_queue_timeout_pop () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#4 0x00007ffff58f76b2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#5 0x00007ffff58f6eb5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#6 0x00007ffff5ddcf8e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#7 0x00007ffff60ebe1d in clone () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.

Thread 6 (Thread 0x7fffca449700 (LWP 3426)):
#0 0x00007ffff58cfbb0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#1 0x00007ffff58d3088 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#2 0x00007ffff58d3248 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#3 0x00007ffff58d3304 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#4 0x00007ffff58d3361 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#5 0x00007ffff58f6eb5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#6 0x00007ffff5ddcf8e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#7 0x00007ffff60ebe1d in clone () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.

Thread 4 (Thread 0x7fffde930700 (LWP 3423)):
#0 0x00007ffff60df3cd in poll () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#1 0x00007ffff58d31dc in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#2 0x00007ffff58d36ba in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#3 0x00007fffec8ee4f6 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
No symbol table info available.
#4 0x00007ffff58f6eb5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#5 0x00007ffff5ddcf8e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#6 0x00007ffff60ebe1d in clone () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.

Thread 2 (Thread 0x7fffef2d8700 (LWP 3421)):
#0 0x00007ffff60df3cd in poll () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#1 0x00007ffff3be4982 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
No symbol table info available.
#2 0x00007ffff3be60ff in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
No symbol table info available.
#3 0x00007ffff02e7659 in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/plugins/platforms/libqxcb.so
No symbol table info available.
#4 0x00007ffff6963eb5 in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#5 0x00007ffff5ddcf8e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#6 0x00007ffff60ebe1d in clone () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.

Thread 1 (Thread 0x7ffff7fc9780 (LWP 3417)):
#0 0x00007ffff7087860 in QPixmap::isNull() const () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#1 0x00007ffff708789c in QPixmap::toImage() const () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#2 0x0000000000406a28 in MainWindow::brightnessProcessing (this=0x7fffffffafc0, value=2) at ../../qt workspace/Auroras/mainwindow.cpp:160
image = <incomplete type>
w = 32767
c = {cspec = 11302176, ct = {argb = {alpha = 0, red = 0, green = 50021, blue = 63345, pad = 32767}, ahsv = {alpha = 0, hue = 0, saturation = 50021, value = 63345, pad = 32767}, acmyk = {alpha = 0, cyan = 0, magenta = 50021, yellow = 63345, black = 32767}, ahsl = {alpha = 0, hue = 0, saturation = 50021, lightness = 63345, pad = 32767}, array = {0, 0, 50021, 63345, 32767}}}
g = 11302240
h = 11302176
r = 0
b = 0
#3 0x00000000004096e3 in BrightnessContrast::on_horizontalSliderBrightness_ valueChanged (this=0x7fffffffc860, value=2) at ../../qt workspace/Auroras/brightnesscontrast.cpp:21
respond = {<QMainWindow> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x7ffff7db1760 <QMainWindow::staticMetaObject>, stringdata = 0x428f60 <qt_meta_stringdata_MainWindow>, data = 0x4292a0 <qt_meta_data_MainWindow>, static_metacall = 0x40a2b0 <MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, ui = 0x918080, image = 0x0, imageLabel = 0xc3f1e0, scrollArea = 0xc3f050, scrollBar = 0x7fffffffc860, scaleFactor = 6.9533558068310629e-310}
#4 0x000000000040a591 in BrightnessContrast::qt_static_metacall (_o=0x7fffffffc860, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffb220) at moc_brightnesscontrast.cpp:73
_t = 0x7fffffffc860
#5 0x000000000040a6a6 in BrightnessContrast::qt_metacall (this=0x7fffffffc860, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffb220) at moc_brightnesscontrast.cpp:106
No locals.
#6 0x00007ffff6b54683 in QMetaObject::activate(QObject*, int, int, void**) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#7 0x00007ffff7a76e4e in QAbstractSlider::valueChanged(int) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#8 0x00007ffff77efa8a in QAbstractSlider::setValue(int) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#9 0x00007ffff7880138 in QSlider::mouseMoveEvent(QMouseEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#10 0x00007ffff77278a2 in QWidget::event(QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#11 0x00007ffff787f990 in QSlider::event(QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#12 0x00007ffff76f0b54 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#13 0x00007ffff76f3e39 in QApplication::notify(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#14 0x00007ffff6b2cdd4 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#15 0x00007ffff76f2fa8 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#16 0x00007ffff7746865 in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#17 0x00007ffff7748a70 in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#18 0x00007ffff76f0b54 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#19 0x00007ffff76f3fe6 in QApplication::notify(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#20 0x00007ffff6b2cdd4 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
...............................................


and next:


.................................................. ....
#21 0x00007ffff703801b in QGuiApplicationPrivate::processMouseEvent(QWindowS ystemInterfacePrivate::MouseEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#22 0x00007ffff70388ed in QGuiApplicationPrivate::processWindowSystemEvent(Q WindowSystemInterfacePrivate::WindowSystemEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#23 0x00007ffff7021a98 in QWindowSystemInterface::sendWindowSystemEventsImpl ementation(QFlags<QEventLoop::ProcessEventsFlag>) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#24 0x00007ffff033b940 in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/plugins/platforms/libqxcb.so
No symbol table info available.
#25 0x00007ffff58d2f05 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#26 0x00007ffff58d3248 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#27 0x00007ffff58d3304 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#28 0x00007ffff6b77314 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#29 0x00007ffff6b2bb6b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#30 0x00007ffff78e446d in QDialog::exec() () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#31 0x00000000004066fe in MainWindow::on_actionBrightness_Contrast_triggered (this=0x7fffffffe210) at ../../qt workspace/Auroras/mainwindow.cpp:103
w = {<QDialog> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x7ffff7da00c0 <QDialog::staticMetaObject>, stringdata = 0x4294c0 <qt_meta_stringdata_BrightnessContrast>, data = 0x4295c0 <qt_meta_data_BrightnessContrast>, static_metacall = 0x40a544 <BrightnessContrast::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, ui = 0x9f18e0}
#32 0x000000000040a3bb in MainWindow::qt_static_metacall (_o=0x7fffffffe210, _c=QMetaObject::InvokeMetaMethod, _id=11, _a=0x7fffffffcaa0) at moc_mainwindow.cpp:133
_t = 0x7fffffffe210
#33 0x000000000040a4dc in MainWindow::qt_metacall (this=0x7fffffffe210, _c=QMetaObject::InvokeMetaMethod, _id=11, _a=0x7fffffffcaa0) at moc_mainwindow.cpp:169
No locals.
#34 0x00007ffff6b54683 in QMetaObject::activate(QObject*, int, int, void**) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#35 0x00007ffff76e5ba2 in QAction::triggered(bool) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#36 0x00007ffff76e79d7 in QAction::activate(QAction::ActionEvent) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#37 0x00007ffff786620a in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#38 0x00007ffff786d41f in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#39 0x00007ffff786e3a0 in QMenu::mouseReleaseEvent(QMouseEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#40 0x00007ffff772786e in QWidget::event(QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#41 0x00007ffff78700eb in QMenu::event(QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#42 0x00007ffff76f0b54 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#43 0x00007ffff76f3e39 in QApplication::notify(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#44 0x00007ffff6b2cdd4 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#45 0x00007ffff76f2fa8 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#46 0x00007ffff774656c in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#47 0x00007ffff7748a70 in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#48 0x00007ffff76f0b54 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#49 0x00007ffff76f3fe6 in QApplication::notify(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Widgets.so.5
No symbol table info available.
#50 0x00007ffff6b2cdd4 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#51 0x00007ffff703801b in QGuiApplicationPrivate::processMouseEvent(QWindowS ystemInterfacePrivate::MouseEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#52 0x00007ffff70388ed in QGuiApplicationPrivate::processWindowSystemEvent(Q WindowSystemInterfacePrivate::WindowSystemEvent*) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#53 0x00007ffff7021a98 in QWindowSystemInterface::sendWindowSystemEventsImpl ementation(QFlags<QEventLoop::ProcessEventsFlag>) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#54 0x00007ffff033b940 in ?? () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/plugins/platforms/libqxcb.so
No symbol table info available.
#55 0x00007ffff58d2f05 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#56 0x00007ffff58d3248 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#57 0x00007ffff58d3304 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#58 0x00007ffff6b77314 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#59 0x00007ffff6b2bb6b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#60 0x00007ffff6b2fbbe in QCoreApplication::exec() () from /media/bachkimfly/data1/programs/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#61 0x0000000000405aa6 in main (argc=1, argv=0x7fffffffe368) at ../../qt workspace/Auroras/main.cpp:10
a = <incomplete type>
w = {<QMainWindow> = {<No data fields>}, static staticMetaObject = {d = {superdata = 0x7ffff7db1760 <QMainWindow::staticMetaObject>, stringdata = 0x428f60 <qt_meta_stringdata_MainWindow>, data = 0x4292a0 <qt_meta_data_MainWindow>, static_metacall = 0x40a2b0 <MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, ui = 0x947290, image = 0xabaf80, imageLabel = 0x9955d0, scrollArea = 0x951f60, scrollBar = 0x40a6d0 <__libc_csu_init>, scaleFactor = 1}

wysota
8th October 2013, 14:23
Do you have two threads accessing your UI?

bachkimfly
8th October 2013, 17:30
Do you have two threads accessing your UI?

what do that mean?

Added after 1 12 minutes:

I know that calling a mainwindow's function from a dialog is a bad practice. So, I found out a instruction:

You should emit a signal acknowledging that the user has made an input, and connect that signal to a proper slot in your MainWindow and connect that signal and slot in your MainWindow's constructor
But i don't perform to this way. Can you help me by some example?

Added after 33 minutes:

I did this, but nothing change. what did I wrong?


//brightnesscontrast.cpp

MainWindow respond;
connect(ui->horizontalSliderBrightness, SIGNAL(valueChanged(int)), &respond, SLOT(respond.brightnessProcessing(value);));

wysota
9th October 2013, 07:44
what do that mean?
I don't know how to make that clearer. Are you starting any threads in your program?


But i don't perform to this way. Can you help me by some example?
I'm afraid "some example" will not help you, there are already a lot of examples on using signals and slots so making one more would not change anything.


I did this, but nothing change. what did I wrong?


//brightnesscontrast.cpp

MainWindow respond;
connect(ui->horizontalSliderBrightness, SIGNAL(valueChanged(int)), &respond, SLOT(respond.brightnessProcessing(value);));


respond goes out of scope and is destroyed before it has a chance to do anything. I think you need to improve your C++ skills, especially the concept of pointers, variable scopes and such.

bachkimfly
9th October 2013, 16:37
yep. thank for helping

myta212
10th October 2013, 07:42
Hi bachkimfly,
You need to learn more about signals and slots.
I give you simple code using your problems.
I hope you can get more information about implement signal and slots from this example.
Please running the program, click setting toolbar and try to change slider brightness.

Thank you.
Best regards,

Myta