GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
DelegateSuggestion.cpp
Go to the documentation of this file.
1#line 2 "src/Gui/AccountRegister/DelegateSuggestion.cpp"
2
3#include <Wt/WSuggestionPopup.h>
4#include <Wt/WDateTime.h>
5
6#include "Editor.h"
8
9/* * * * * * * * * * * * * * * * * * * * * * * * * * */
10
11
14{
15// std::cout << __FILE__ << ":" << __LINE__ << " " << __FUNCTION__ << "(): " << std::endl;
16}
17
20{
21// std::cout << __FILE__ << ":" << __LINE__ << " " << __FUNCTION__ << "(): " << std::endl;
22}
23
24auto
26createEditor( const Wt::WModelIndex & _index, Wt::WFlags< Wt::ViewItemRenderFlag > _flags ) const-> std::unique_ptr< Wt::WWidget >
27{
28#ifdef NEVER
29 std::cout << __FILE__ << ":" << __LINE__
30 << "(): " << _index.row() << "," << _index.column()
31 << " SuggestionDelegate::" << __FUNCTION__
32 << " '" << Wt::asString( _index.data( Wt::ItemDataRole::Edit ) ) << "'"
33 << std::endl;
34#endif
35
36 auto retVal = DelegateBase::createEditor( _index, _flags );
37 auto cw = dynamic_cast< Wt::WContainerWidget* >( retVal.get() );
38 auto lineEdit = dynamic_cast< Wt::WLineEdit* >( cw-> widget(0) );
39
40 if( false /* lineEdit */ )
41 {
42 // options for email address suggestions
44 {
45 "<b>", // highlightBeginTag
46 "</b>", // highlightEndTag
47 ',', // listSeparator (for multiple addresses)
48 " \n", // whitespace
49 "()[]{}-., \"@\n;:", // wordSeparators (within an address)
50 "" // appendReplacedText (prepare next email address)
51 };
52
53 auto popup = retVal-> addChild( std::make_unique< Wt::WSuggestionPopup >( popupOptions ) );
54 popup-> forEdit( lineEdit );
55
56// auto batchEditModel = dynamic_cast< const Wt::WBatchEditProxyModel* >( _index.model() );
57// auto sortFilterModel = dynamic_cast< const Wt::WSortFilterProxyModel* >( _index.model() );;
58// auto baseModel = dynamic_cast< const GCW::Gui::AccountRegister::BaseModel* >( sortFilterModel-> sourceModel().get() );
59 auto baseModel = dynamic_cast< const GCW::Gui::AccountRegister::Model* >( _index.model() );
60
61 for( auto item : baseModel-> suggestionsFromColumn( _index.column() ) )
62 popup-> addSuggestion( item, item );
63 }
64
65 return retVal;
66
67} // endcreateEditor( const Wt::WModelIndex & _index, Wt::WFlags< Wt::ViewItemRenderFlag > _flags ) const-> std::unique_ptr< Wt::WWidget >
68
69
70
virtual auto createEditor(const Wt::WModelIndex &index, Wt::WFlags< Wt::ViewItemRenderFlag > flags) const -> std::unique_ptr< Wt::WWidget >
virtual auto createEditor(const Wt::WModelIndex &_index, Wt::WFlags< Wt::ViewItemRenderFlag > _flags) const -> std::unique_ptr< Wt::WWidget >
Account Register Model.
Definition Model.h:30
static constexpr const int Edit
WString asString(const cpp17::any &v, const WString &formatString=WString())