2

I'm trying to create a GUI for sudoku (for improving my QT5 skills). I have decided to use for these purposes a QTableView. Up until that point there is no problem.

enter image description here

Now i want to draw grids to make 3x3 fields more visible. Is there any ideas, how i can do that?

  • [Might be useful](http://stackoverflow.com/questions/7262318/how-do-i-assign-a-border-to-a-specific-qtablewidgetitem-or-a-row-in-a-qtablewidg) – GPPK Jan 14 '16 at 16:06
  • Gosh, please, you've found a hammer and now everything looks like a nail to you? Create a custom widget for this! – peppe Jan 15 '16 at 13:48

1 Answers1

2

I would really recommend not using a QTableView for this, it's potentially solvable by using delegates (which are mostly for data presentation) but it would be very tricky. The best solution would be for you to build a custom widget by subclassing QWidget, building the paintEvent functionality and putting a data model in place. I know that building a custom widget certainly sounds more difficult, but it's actually quite simple.

Here's some good resources to get started with:

After that the QPainter class reference will be very useful to implement your drawing commands.

Nicholas Smith
  • 11,642
  • 6
  • 37
  • 55