Making a checkbox checked
-
Pardon me - actually it shouldn't make any difference whether you call setChecked(1) after show() call or before. Tried a sample code, to just confirm it, and it is working for me.
Just added a CheckBox to the UI and added a method as you said and called the same after showing the widget, I see the checkbox is checked.
-
hi,
i will show screenshot when project finished, because we have to buy licence before using it on robot.ah the error was that i made the checkbox "not checkable"
but now when it is checkable, the user can uncheck it. thats not mentioned.
so i always have to
make it checkable, then check/uncheck it and then make it again uncheckable ... -
thank u guys for helping.
when i only make
@ ui->chkbox_client->setChecked(1);@
its checked, but its changable by hand - it mustn't and should be stablewhen
@ ui->chkbox_client->setChecked(1);
ui->chkbox_client->setCheckable(0);@
its not checkable by hand, but the check is removedany ideas?
-
Or just use checkbox::setEnabled(false). It will gray the widget out, though. This probably can be overridden.
-
hi,
now i have a strange problemin main.cpp
@
w.chkbox_client;@works great and set the box checked.
but also in main.cpp,
@
QObject::connect(st.socket,SIGNAL(connected()), &w, SLOT(chkbox_client()));@
doesn't work, even i see there is a signal connected emittet.i can see it because in the tcpconnect class, i put this signals out with qdebug, so i see exactly its connected.
and in my main.cpp
i have this:@
QObject::connect(st.socket,SIGNAL(readyRead()), &w, SLOT(loadTextFile() ) );@
and this works great.thankful for any hints
PS:
btw st is an object made of the class qtcpsocket, and there its made with socket = new QTcpSocket(this);
and there i have piped the connection signal out@
connect(socket,SIGNAL(connected()), this, SLOT(connected()));@where connected is a method who tells the connection via qdebug to me
general second question:
is the main.cpp the right place for those - inter class connections? -
Does st.socked return a pointer?
-
hi,
i think so,
because no errors when compiling, and when i do with
&st.socket
there is an error
@C:\Dokumente und Einstellungen\loetrobo\Robbie20-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug..\Robbie20\main.cpp:19: error: no matching function for call to 'QObject::connect(QTcpSocket**, const char*, Robbie20*, const char*)'@
looking like a double pointer so without &
it should be normal pointer