~ubuntu-branches/ubuntu/quantal/qgis/quantal

« back to all changes in this revision

Viewing changes to src/gui/qgsidentifyresults.h

  • Committer: Bazaar Package Importer
  • Author(s): William Grant
  • Date: 2007-05-06 13:42:32 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070506134232-pyli6t388w5asd8x
Tags: 0.8.0-3ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - debian/rules, debian/qgis.install, debian/qgis.dirs debian/qgis.desktop:
    Add and install .desktop.
* debian/qgis.desktop: Remove Applications category; it's not real.
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                      qgsidentifyresults.h  -  description
 
3
                               ------------------
 
4
        begin                : Fri Oct 25 2002
 
5
        copyright            : (C) 2002 by Gary E.Sherman
 
6
        email                : sherman at mrcc dot com
 
7
        Romans 3:23=>Romans 6:23=>Romans 5:8=>Romans 10:9,10=>Romans 12
 
8
 ***************************************************************************/
 
9
 
 
10
/***************************************************************************
 
11
 *                                                                         *
 
12
 *   This program is free software; you can redistribute it and/or modify  *
 
13
 *   it under the terms of the GNU General Public License as published by  *
 
14
 *   the Free Software Foundation; either version 2 of the License, or     *
 
15
 *   (at your option) any later version.                                   *
 
16
 *                                                                         *
 
17
 ***************************************************************************/
 
18
/* $Id: qgsidentifyresults.h 6090 2006-11-16 02:27:32Z gsherman $ */
 
19
#ifndef QGSIDENTIFYRESULTS_H
 
20
#define QGSIDENTIFYRESULTS_H
 
21
 
 
22
#include "ui_qgsidentifyresultsbase.h"
 
23
#include "qgsattributeaction.h"
 
24
#include <QWidget>
 
25
#include <vector>
 
26
#include <map>
 
27
 
 
28
class QCloseEvent;
 
29
class QTreeWidgetItem;
 
30
class QAction;
 
31
class QMenu;
 
32
 
 
33
/**
 
34
 *@author Gary E.Sherman
 
35
 */
 
36
 
 
37
class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase
 
38
{
 
39
  Q_OBJECT;
 
40
  public:
 
41
 
 
42
  //! Constructor - takes it own copy of the QgsAttributeAction so
 
43
  // that it is independent of whoever created it.
 
44
  QgsIdentifyResults(const QgsAttributeAction& actions, QWidget *parent = 0, Qt::WFlags f = 0);
 
45
 
 
46
  ~QgsIdentifyResults();
 
47
 
 
48
  /** Add an attribute to the feature display node */
 
49
  void addAttribute(QTreeWidgetItem *parent, QString field, QString value);
 
50
 
 
51
  /** Add an attribute */
 
52
  void addAttribute(QString field, QString value);
 
53
 
 
54
  /** Add a derived attribute (e.g. Length, Area) to the feature display node */
 
55
  void addDerivedAttribute(QTreeWidgetItem *parent, QString field, QString value);
 
56
 
 
57
  /** Add an action to the feature display node */
 
58
  void addAction(QTreeWidgetItem *parent, int id, QString field, QString value);
 
59
 
 
60
  /** Add a feature node to the feature display */
 
61
  QTreeWidgetItem * addNode(QString label);
 
62
  /** Set the title for the identify results dialog */
 
63
  void setTitle(QString title);
 
64
  /** Set header column */
 
65
  void setColumnText ( int column, const QString & label );
 
66
  void saveWindowLocation();
 
67
  void restorePosition();  
 
68
  void closeEvent(QCloseEvent *e);
 
69
  void showAllAttributes();
 
70
 
 
71
  /** Resize all of the columns to fit the data in them */
 
72
  void expandColumnsToFit();
 
73
 
 
74
  /** Remove results */
 
75
  void clear();
 
76
  
 
77
  /** Set "No features ... " */
 
78
  void setMessage( QString shortMsg, QString longMsg );
 
79
 
 
80
  /** Set actions */
 
81
  void setActions ( const QgsAttributeAction& actions );
 
82
  
 
83
  //void accept();
 
84
  //void reject();
 
85
 
 
86
  public slots:
 
87
 
 
88
    void show();
 
89
 
 
90
    void close();
 
91
    void contextMenuEvent(QContextMenuEvent*);
 
92
    void popupItemSelected(QAction* menuAction);
 
93
 
 
94
    /* Item in tree was clicked */
 
95
    void clicked ( QTreeWidgetItem *lvi );
 
96
 
 
97
    //! Context help
 
98
    void on_buttonHelp_clicked();
 
99
 
 
100
    /* Called when an item is expanded so that we can ensure that the
 
101
       column width if expanded to show it */
 
102
    void itemExpanded(QTreeWidgetItem*);
 
103
 
 
104
 private:
 
105
  
 
106
  QgsAttributeAction mActions;
 
107
  int mClickedOnValue;
 
108
  QMenu* mActionPopup;
 
109
  std::vector<std::pair<QString, QString> > mValues;
 
110
  static const int context_id = 689216579;
 
111
 
 
112
  /**
 
113
   Keeps track of what derived-attribute (e.g. Length, Area)
 
114
   root nodes have been generated for each feature in this widget.
 
115
 
 
116
   First item:  Feature root node
 
117
   Second item: Derived-attribute root node for that feature
 
118
   */
 
119
  std::map<QTreeWidgetItem *, QTreeWidgetItem *> mDerivedAttributeRootNodes;
 
120
};
 
121
 
 
122
#endif