Unsolved Need help about Sudoku's cells
-
Hello,
I coded a Sudoku, I have used QLineEdit for the cells and I write the digits from 1 to 9, it works but now I would like to add a "hint" option which would display the candidate digits written in very little in each empty cell.
How can I do that?
Can I do that with QLineEdit (with something like a mask or background option which would overlap the cell)?
Do I have to use another QWidget?
Do I have to custom my own widget?(I also would like to be able to draw a circle in a cell, that's for another gridgame but if you have an idea, would be lovely).
Thank you.
P.S. Sorry English is not my mother tongue.
-
A simple way you could accomplish the hint option is to use tool tips. I know this isn't what you asked for though. Maybe you could use a font subscript to do it as well? I've not tried that.
-
Hi,
One idea that comes to mind is to use a QTableWidget and make a custom QStyledItemDelegate.
Hope it helps
-
@Calivernon said:
Hi
it would work best with a custom control and its own paintevent but
you must also make sure u can still input the number so
would need some code for your own widget.To display hint, you could use a QLabel that you "move to front" so it will
be on top of the LineEdit.To draw circle later:
QPixMap pix(100,100);
QPainter painter(&pix);
painter.drawEllipse(0,0,100,100);
painter.end();
ui->someLabel.setPixmap(pix); << use QLabel to display pixmapAlso for fun. advanced version to look at:
https://github.com/wimleers/sudoku -
Hi, thank you guys, I am going to try that.
Thanks, bye bye