thec0der
2nd February 2011, 09:56
Hi there!
I've run in troubles, when I try to use QComboBox with QDataWidgetMapper.
I have a SQL table like this one -
create table `test` (
`id` int not null auto_increment,
`name` varchar(255) not null,
`color` enum('black', 'cyan', 'magenta', 'yellow', 'mix') default 'black',
`enabled` enum('yes','no') default 'no',
primary key(`id`),
key(`enabled`)
) Engine=InnoDB default charset=utf8 collate=utf8_unicode_ci;
I'd expected, when I map QComboBox with table index for field "color" or "enabled", to have a list of all enum values loaded in QComboBox, and when I iterate trough records, selected value in QComboBox to be the value from current record.
Unfortunately nor the QComboBox was filled with enum values, nor select value from current record.
Any ideas?
Thanks,
D. Michev
I've run in troubles, when I try to use QComboBox with QDataWidgetMapper.
I have a SQL table like this one -
create table `test` (
`id` int not null auto_increment,
`name` varchar(255) not null,
`color` enum('black', 'cyan', 'magenta', 'yellow', 'mix') default 'black',
`enabled` enum('yes','no') default 'no',
primary key(`id`),
key(`enabled`)
) Engine=InnoDB default charset=utf8 collate=utf8_unicode_ci;
I'd expected, when I map QComboBox with table index for field "color" or "enabled", to have a list of all enum values loaded in QComboBox, and when I iterate trough records, selected value in QComboBox to be the value from current record.
Unfortunately nor the QComboBox was filled with enum values, nor select value from current record.
Any ideas?
Thanks,
D. Michev