• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

parley

  • sources
  • kde-4.14
  • kdeedu
  • parley
  • src
  • editor
vocabularyheaderview.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  Copyright 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
3  ***************************************************************************/
4 
5 /***************************************************************************
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  ***************************************************************************/
13 #include "vocabularyheaderview.h"
14 
15 using namespace Editor;
16 
17 VocabularyHeaderView::VocabularyHeaderView(Qt::Orientation orientation, QWidget * parent)
18  : QHeaderView(orientation, parent)
19 {
20  setClickable(true);
21  connect(this, SIGNAL(sectionClicked(int)), this, SLOT(updateSorting(int)));
22  m_sortSection = -1;
23 }
24 
25 void VocabularyHeaderView::updateSorting(int index)
26 {
27  if (m_sortSection != index) {
28  setSortIndicatorShown(true);
29  setSortIndicator(index, Qt::AscendingOrder);
30  m_sortSection = index;
31  return;
32  }
33 
34  if (sortIndicatorOrder() == Qt::DescendingOrder) {
35  setSortIndicatorShown(true);
36  setSortIndicator(index, Qt::DescendingOrder);
37  return;
38  }
39 
40  if (!isSortIndicatorShown()) {
41  setSortIndicatorShown(true);
42  setSortIndicator(index, Qt::AscendingOrder);
43  return;
44  }
45 
46  setSortIndicatorShown(false);
47  m_sortSection = -1;
48  model()->sort(-1);
49 }
50 
51 #include "vocabularyheaderview.moc"
vocabularyheaderview.h
QWidget
QHeaderView::setSortIndicatorShown
void setSortIndicatorShown(bool show)
QAbstractItemModel::sort
virtual void sort(int column, Qt::SortOrder order)
QHeaderView::sectionClicked
void sectionClicked(int logicalIndex)
QHeaderView::setSortIndicator
void setSortIndicator(int logicalIndex, Qt::SortOrder order)
QHeaderView::sortIndicatorOrder
Qt::SortOrder sortIndicatorOrder() const
QHeaderView::setClickable
void setClickable(bool clickable)
QHeaderView
QAbstractItemView::model
QAbstractItemModel * model() const
Editor::VocabularyHeaderView::VocabularyHeaderView
VocabularyHeaderView(Qt::Orientation orientation, QWidget *parent=0)
Definition: vocabularyheaderview.cpp:17
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal