So I ran into the problem in Qt a while back of not being able to disable certain items in a QComboBox widget. Since when I was looking for it I couldn't find a solution, I figured I'd post the solution here even though nobody will probably ever read it.
You have to use the QAbstractItemModel's setFlags() method. Wait, what do you mean there's no setFlags() method? Oh, well just use the setData() method and have the role as 'Qt::UserRole - 1'. Because that makes so much sense. bleh. I hope qt fixes that.
Unfortunately I can't take a screenshot of it right now. But here's my solution anyways. Hope this helps somebody.
----------------------------------------------------------------------------------------------------------------
// Get the index of the value to disable
QModelIndex index = ui.comboBox->model()->index(1,0);
// This is the effective 'disable' flag
QVariant v(0);
//the magic
ui.comboBox->model()->setData( index, v, Qt::UserRole -1);
----------------------------------------------------------------------------------------------------------------
Tuesday, January 25, 2011
Wednesday, October 7, 2009
Keyboard layout all jacked up when VNC'ing into Gnome
So I got Ubuntu 9.04 installed on my wanna be HTPC. I try to VNC ( ultraVNC) into via PuTTy through my desktop windows box and when I try to type stuff it all comes out stupid. The keyboard layout was completely jacked. I hit an 's' and out comes a 'b'. So anyways looking around on them world wide internets I find a bunch of people with the same problem. I have no clue as to how it works, but it worked.
Here's the fix:
in your ~/.vnc/xstartup file, make it look like this
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
export XKL_XMODMAP_DISABLE=1 ##### <<<<<<>
/etc/X11/Xsession
It was a pain in the ass to find so I'm "e-blogging" about it. Hope this helps someone out there.
Saturday, August 29, 2009
Subscribe to:
Posts (Atom)