insert QCalendarWidget into QTableView Column cells
-
@JonB I didnt say about QComboBox but yeah mousewheel is do nothing in QComboBox as well. But in the QCalendarWidget is do, but do the qtableview also, the calendar is open in vain.
If i disable the QtableView with table->setDisabled(true) then disable the calendar as well. Or there is a different way for it?@Kaguro said in insert QCalendarWidget into QTableView Column cells:
If i disable the QtableView with table->setDisabled(true) then disable the calendar as well.
When/where do you do this? I was thinking it would be OK at the end of
createEditor()
, or even perhaps in, say, theQCalendarWidget::showEvent()
, but maybe not. It was just a suggestion.I now see bool QStyledItemDelegate::eventFilter(QObject *editor, QEvent *event) [override virtual protected]. Are you maybe supposed to override that and make it return
true
for the events you say are presently handled by theQTableView
but you would like handled by yourQCalendarWidget
? -
Hi Guys!
I have a QTableView and i would like to achive that when i click into a date cell pop up a QCalendarWidget from it and i can select the date (like spinbox delegate example).
How can i achive this?
Thanks your help! -
@Kaguro
So adapt theQSpinBox
delegate example to useQCalendarWidget
. QStyledItemDelegate::createEditor() is where you create you desired editingQWidget
.@JonB Sorry for late!
Thanks the advice its working partly.
When pop up the calendar i cant select the date with mouse click or enter (nothing happen). If i clcik somewhere else the calendar widget close perfectly and write the selected date into the cell, its good.
When i use arrow or mousewheel to select a date then activate the qtableview events, so select another qtableview cell or scrolling the tableview with mousewheel.
So how can i ignore qtableview events when popup the calendar? And how can i select the date into the cell with doublemouseclick or enter?
Thanks your help! :) -
@JonB Sorry for late!
Thanks the advice its working partly.
When pop up the calendar i cant select the date with mouse click or enter (nothing happen). If i clcik somewhere else the calendar widget close perfectly and write the selected date into the cell, its good.
When i use arrow or mousewheel to select a date then activate the qtableview events, so select another qtableview cell or scrolling the tableview with mousewheel.
So how can i ignore qtableview events when popup the calendar? And how can i select the date into the cell with doublemouseclick or enter?
Thanks your help! :)@Kaguro
Only a guess. Not sure why/whether, say, mousewheel works for aQComboBox
but not for aQCalendarWidget
. Maybe one way would be to disable theQTableView
while theQCalendarWidget
is being edited, if that makes the events go to the latter instead? Or maybe do this with aneventFilter()
? -
@Kaguro
Only a guess. Not sure why/whether, say, mousewheel works for aQComboBox
but not for aQCalendarWidget
. Maybe one way would be to disable theQTableView
while theQCalendarWidget
is being edited, if that makes the events go to the latter instead? Or maybe do this with aneventFilter()
?@JonB I didnt say about QComboBox but yeah mousewheel is do nothing in QComboBox as well. But in the QCalendarWidget is do, but do the qtableview also, the calendar is open in vain.
If i disable the QtableView with table->setDisabled(true) then disable the calendar as well. Or there is a different way for it? -
@JonB I didnt say about QComboBox but yeah mousewheel is do nothing in QComboBox as well. But in the QCalendarWidget is do, but do the qtableview also, the calendar is open in vain.
If i disable the QtableView with table->setDisabled(true) then disable the calendar as well. Or there is a different way for it?@Kaguro said in insert QCalendarWidget into QTableView Column cells:
If i disable the QtableView with table->setDisabled(true) then disable the calendar as well.
When/where do you do this? I was thinking it would be OK at the end of
createEditor()
, or even perhaps in, say, theQCalendarWidget::showEvent()
, but maybe not. It was just a suggestion.I now see bool QStyledItemDelegate::eventFilter(QObject *editor, QEvent *event) [override virtual protected]. Are you maybe supposed to override that and make it return
true
for the events you say are presently handled by theQTableView
but you would like handled by yourQCalendarWidget
? -
@Kaguro said in insert QCalendarWidget into QTableView Column cells:
If i disable the QtableView with table->setDisabled(true) then disable the calendar as well.
When/where do you do this? I was thinking it would be OK at the end of
createEditor()
, or even perhaps in, say, theQCalendarWidget::showEvent()
, but maybe not. It was just a suggestion.I now see bool QStyledItemDelegate::eventFilter(QObject *editor, QEvent *event) [override virtual protected]. Are you maybe supposed to override that and make it return
true
for the events you say are presently handled by theQTableView
but you would like handled by yourQCalendarWidget
?