Home > Mobile >  QTableView touch sliding at the same time according to the sorting space problems
QTableView touch sliding at the same time according to the sorting space problems

Time:12-26

Touch the slide to the end, in the Header sorting, frequent operation will appear QTableView head a blank, as shown in figure


Post code:
 QStandardItemModel * modal=new QStandardItemModel (this); 

For (int I=0; I & lt; 100; I++)
{
Modal - & gt; SetItem (I, 0, new QStandardItem (QString (" % 1 "). Arg (I)));
}

The UI - & gt; TableView - & gt; SetModel (modal);

The UI - & gt; TableView - & gt; ScrollToTop ();
The UI - & gt; TableView - & gt; The verticalHeader () - & gt; Hide ();
The UI - & gt; TableView - & gt; SetShowGrid (false);

The UI - & gt; TableView - & gt; SetSortingEnabled (true);

The UI - & gt; TableView - & gt; The horizontalHeader () - & gt; SetDefaultAlignment (Qt: : AlignLeft);
The UI - & gt; TableView - & gt; The horizontalHeader () - & gt; SetSectionResizeMode (QHeaderView: : Stretch);
The UI - & gt; TableView - & gt; SetSelectionBehavior (QAbstractItemView: SelectRows);
The UI - & gt; TableView - & gt; SetSelectionMode (QAbstractItemView: : SingleSelection);
The UI - & gt; TableView - & gt; SetEditTriggers (QAbstractItemView: NoEditTriggers);
The UI - & gt; TableView - & gt; SetVerticalScrollMode (QAbstractItemView: ScrollPerItem);
The UI - & gt; TableView - & gt; SetFrameShape (QFrame: : NoFrame);

The UI - & gt; TableView - & gt; SetShowGrid (false);
The UI - & gt; TableView - & gt; The verticalHeader () - & gt; SetDefaultSectionSize (40);
The UI - & gt; TableView - & gt; The horizontalHeader () - & gt; SetHighlightSections (false);
The UI - & gt; TableView - & gt; InstallEventFilter (this);
The UI - & gt; TableView - & gt; SetIconSize (QSize (30, 30));

The UI - & gt; TableView - & gt; The horizontalHeader () - & gt; SetSortIndicator (0, Qt: : AscendingOrder);

The UI - & gt; TableView - & gt; SetVerticalScrollMode (QAbstractItemView: ScrollPerPixel);
QScroller: : grabGesture (UI - & gt; TableView - & gt; Viewport (), QScroller: : LeftMouseButtonGesture);//set the scroll gesture recognizer
  •  Tags:  
  • Qt
  • Related