Hi,
I think I'm missing something easy. I have a slot that is called when a checkbox is checked. It makes the text in a textEdit become right justified. I want the text to be sent back to the left when I uncheck the box, How do I do that?
I have tried using all the different signals for qcheckbox
this is my code
connect(checkAxis, SIGNAL(pressed()), this, SLOT(setAxis()));
void MyWidget::setAxis(){
textblock.setAlignment(Qt::AlignRight);
cursorArea.setBlockFormat(textblock);
}
connect(checkAxis, SIGNAL(pressed()), this, SLOT(setAxis()));
void MyWidget::setAxis(){
QTextCursor cursorArea = textedit->textCursor();
QTextBlockFormat textblock = cursorArea.blockFormat();
textblock.setAlignment(Qt::AlignRight);
cursorArea.setBlockFormat(textblock);
}
To copy to clipboard, switch view to plain text mode
I also tried making a second slot that is the same as setAxis, just it aligns left, and connect it with released, but that didn't work either.
connect(checkAxis, SIGNAL(released()), this, SLOT(setAxisBack()));
connect(checkAxis, SIGNAL(released()), this, SLOT(setAxisBack()));
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks