addTabWidget.patch

lynxID -, 2009-04-04 01:05 PM

Download (12.2 KB)

View differences:

python/gui/qgisinterface.sip (working copy)
70 70
    /** Return a pointer to the map canvas */
71 71
    virtual QgsMapCanvas * mapCanvas()=0;
72 72

  
73
    /** Return a pointer to the main tab widget */
74
    virtual QTabWidget * tabWidget()=0;
75

  
73 76
    /** Return a pointer to the main window (instance of QgisApp in case of QGIS) */
74 77
    virtual QWidget * mainWindow()=0;
75 78

  
......
90 93
	/** Remove specified dock widget from main window (doesn't delete it). Added in QGIS 1.1. */
91 94
	virtual void removeDockWidget ( QDockWidget * dockwidget )=0;
92 95

  
96
    /** Add a tab widget to the main window */
97
    virtual void addTabWidget( QWidget *page, const QString &label )=0;
98

  
99
    /** Add a tab widget to the main window with icon */
100
    virtual void addTabWidget( QWidget *page, const QIcon &icon, const QString &label )=0;
101

  
102
    /** Insert a tab widget to the main window with label */
103
    virtual void insertTabWidget( int index, QWidget *page, const QString &label )=0;
104

  
105
    /** Insert a tab widget to the main window with icon and label */
106
    virtual void insertTabWidget( int index, QWidget *page, const QIcon &icon, const QString &label )=0;
107

  
108
    /** Remove specified tab widget from main window (doesn't delete it). Added in QGIS 1.1. */
109
    virtual void removeTabWidget( int index )=0;
110

  
93 111
    /** refresh legend of a layer */
94 112
    virtual void refreshLegend( QgsMapLayer * layer )=0;
95 113

  
src/app/qgisappinterface.h (working copy)
85 85
    /** Return a pointer to the map canvas used by qgisapp */
86 86
    QgsMapCanvas * mapCanvas();
87 87

  
88
    /** Return a pointer to the main tab widget that containing map canvas */
89
    virtual QTabWidget * tabWidget();
90

  
88 91
    /** Gives access to main QgisApp object
89 92

  
90 93
        Plugins don't need to know about QgisApp, as we pass it as QWidget,
......
105 108
    /** Remove specified dock widget from main window (doesn't delete it). Added in QGIS 1.1. */
106 109
    void removeDockWidget( QDockWidget * dockwidget );
107 110

  
111
    /** Add a tab widget to the main window */
112
    void addTabWidget( QWidget *page, const QString &label );
113

  
114
    /** Add a tab widget to the main window with icon */
115
    void addTabWidget( QWidget *page, const QIcon &icon, const QString &label );
116

  
117
    /** Insert a tab widget to the main window with label */
118
    void insertTabWidget( int index, QWidget *page, const QString &label );
119

  
120
    /** Insert a tab widget to the main window with icon and label */
121
    void insertTabWidget( int index, QWidget *page, const QIcon &icon, const QString &label );
122

  
123
    /** Remove specified tab widget from main window (doesn't delete it). Added in QGIS 1.1. */
124
    void removeTabWidget( int index );
125

  
108 126
    virtual void refreshLegend( QgsMapLayer *l );
109 127

  
110 128
    /** Add window to Window menu. The action title is the window title
src/app/qgisapp.h (working copy)
59 59
#include <QToolBar>
60 60
#include <QAbstractSocket>
61 61
#include <QPointer>
62
#include <QTabWidget>
63
#include <QTabBar>
62 64

  
63 65
#include "qgsconfig.h"
64 66
#include "qgspoint.h"
......
137 139
    //!Overloaded version of the private function with same name that takes the imagename as a parameter
138 140
    void saveMapAsImage( QString, QPixmap * );
139 141
    /** Get the mapcanvas object from the app */
140
    QgsMapCanvas * mapCanvas() { return mMapCanvas; };
142
    QgsMapCanvas * mapCanvas() { return mMapCanvas; }
141 143

  
144
    /** Get the tabwidget object from the app */
145
    QTabWidget * tabWidget() { return mTabWidget; }
146

  
142 147
    QgsComposer* printComposer() {return mComposer;}
143 148

  
144 149
    //! Set theme (icons)
......
180 185
     * After adding the dock widget to the ui (by delegating to the QMainWindow
181 186
     * parent class, it will also add it to the View menu list of docks.*/
182 187
    void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget );
188

  
189
    /** Add a tab widget to the main window with label */
190
    void addTabWidget( QWidget *page, const QString &label );
191

  
192
    /** Add a tab widget to the main window with icon and label */
193
    void addTabWidget( QWidget *page, const QIcon &icon, const QString &label );
194

  
195
    /** Insert a tab widget to the main window with label */
196
    void insertTabWidget( int index, QWidget *page, const QString &label );
197

  
198
    /** Insert a tab widget to the main window with icon and label */
199
    void insertTabWidget( int index, QWidget *page, const QIcon &icon, const QString &label );
200

  
201
    /** Remove specified dock widget from main window (doesn't delete it). Added in QGIS 1.1. */
202
    void removeTabWidget( int index );
203

  
183 204
    /** Add a toolbar to the main window. Overloaded from QMainWindow.
184 205
     * After adding the toolbar to the ui (by delegating to the QMainWindow
185 206
     * parent class, it will also add it to the View menu list of toolbars.*/
......
814 835
        QgsMapTool* mAddIsland;
815 836
    } mMapTools;
816 837

  
838
//    class QgsTabWidget : public QTabWidget
839
//    {
840
//      public:
841
//      QgsTabWidget(QWidget *parent) {
842
//        QgsTabWidget::QTabWidget();
843
//        tabBar()->hide();
844
//      }
845
//      void addTab(QWidget *widget, const QIcon &icon, const QString &label) { QTabWidget::addTab(widget, icon, label); if (count() > 1) tabBar()->show(); }
846
//      void addTab(QWidget *widget, const QString &label) { QTabWidget::addTab(widget, label); if (count() > 1) tabBar()->show(); }
847
//      void insertTab(int index, QWidget *widget, const QIcon &icon, const QString &label) { QTabWidget::insertTab(index, widget, icon, label); if (count() > 1) tabBar()->show(); }
848
//      void insertTab(int index, QWidget *widget, const QString &label) { QTabWidget::insertTab(index, widget, label); if (count() > 1) tabBar()->show(); }
849
//      void removeTab(int index) { if (count() != 1) { QTabWidget::removeTab(index); if (count() == 1) tabBar()->hide();  } }
850
//    };
851

  
817 852
    QgsMapTool *mNonEditMapTool;
818 853

  
819 854
    //! Widget that will live on the statusbar to display "scale 1:"
......
846 881
    QMenu *toolPopupCapture;
847 882
    //! Map canvas
848 883
    QgsMapCanvas *mMapCanvas;
884
    //! Tab widget
885
//    QgsTabWidget *mTabWidget;
886
    QTabWidget *mTabWidget;
849 887
    //! Table of contents (legend) for the map
850 888
    QgsLegend *mMapLegend;
851 889
    //! Cursor for the overview map
src/app/qgisapp.cpp (working copy)
1548 1548
  // Connect warning dialog from project reading
1549 1549
  connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ),
1550 1550
           this, SLOT( oldProjectVersionWarning( QString ) ) );
1551
}
1551 1552

  
1552
}
1553 1553
void QgisApp::createCanvas()
1554 1554
{
1555 1555
  // "theMapCanvas" used to find this canonical instance later
......
1557 1557
  mMapCanvas->setWhatsThis( tr( "Map canvas. This is where raster and vector "
1558 1558
                                "layers are displayed when added to the map" ) );
1559 1559

  
1560
  setCentralWidget( mMapCanvas );
1560
  mTabWidget = new QTabWidget(this);
1561
  mTabWidget->setTabPosition(QTabWidget::East);
1562
  mTabWidget->addTab(mMapCanvas, tr("2D view"));  
1563

  
1564
  setCentralWidget( mTabWidget );
1565

  
1561 1566
  // set the focus to the map canvas
1562 1567
  mMapCanvas->setFocus();
1563 1568

  
......
1653 1658
  mMapCanvas->refresh();
1654 1659
}
1655 1660

  
1661
void QgisApp::addTabWidget( QWidget *page, const QString &label )
1662
{
1663
  mTabWidget->addTab( page, label );
1664
}
1665

  
1666
void QgisApp::addTabWidget( QWidget *page, const QIcon &icon, const QString &label )
1667
{
1668
  mTabWidget->addTab( page, icon, label );
1669
}
1670

  
1671
void QgisApp::insertTabWidget( int index, QWidget *page, const QString &label )
1672
{
1673
  mTabWidget->insertTab( index, page, label );
1674
}
1675

  
1676
void QgisApp::insertTabWidget( int index, QWidget *page, const QIcon &icon, const QString &label )
1677
{
1678
  mTabWidget->insertTab( index, page, icon, label );
1679
}
1680

  
1681
void QgisApp::removeTabWidget( int index )
1682
{
1683
  mTabWidget->removeTab( index );
1684
}
1685

  
1656 1686
QToolBar *QgisApp::addToolBar( QString name )
1657 1687
{
1658 1688
  QToolBar *toolBar = QMainWindow::addToolBar( name );
src/app/qgisappinterface.cpp (working copy)
136 136
  return qgis->mapCanvas();
137 137
}
138 138

  
139
QTabWidget * QgisAppInterface::tabWidget()
140
{
141
  return qgis->tabWidget();
142
}
143

  
139 144
QWidget * QgisAppInterface::mainWindow()
140 145
{
141 146
  return qgis;
......
169 174
  qgis->removeDockWidget( dockwidget );
170 175
}
171 176

  
177
void QgisAppInterface::addTabWidget( QWidget *page, const QString &label )
178
{
179
  qgis->addTabWidget( page, label );
180
}
181

  
182
void QgisAppInterface::addTabWidget( QWidget *page, const QIcon &icon, const QString &label )
183
{
184
  qgis->addTabWidget( page, icon, label );
185
}
186

  
187
void QgisAppInterface::insertTabWidget( int index, QWidget *page, const QString &label )
188
{
189
  qgis->insertTabWidget( index, page, label );
190
}
191

  
192
void QgisAppInterface::insertTabWidget( int index, QWidget *page, const QIcon &icon, const QString &label )
193
{
194
  qgis->insertTabWidget( index, page, icon, label );
195
}
196

  
197
void QgisAppInterface::removeTabWidget( int index )
198
{
199
  qgis->removeTabWidget( index );
200
}
201

  
172 202
void QgisAppInterface::refreshLegend( QgsMapLayer *l )
173 203
{
174 204
  if ( l && qgis && qgis->legend() )
src/plugins/geoprocessing/qgspggeoprocessing.cpp (working copy)
343 343

  
344 344
                QMessageBox::critical( 0, tr( "Unable to add geometry column" ),
345 345
                                       tr( "Unable to add geometry column to the output table %1-%2" )
346
                                       .arg( bb->bufferLayerName() ).arg( PQerrorMessage( conn ) ) ) );
346
                                       .arg( bb->bufferLayerName() ).arg( PQerrorMessage( conn ) ) );
347 347

  
348 348
              }
349 349
            }
src/plugins/CMakeLists.txt (working copy)
29 29
SUBDIRS (coordinate_capture dxf2shp_converter) 
30 30

  
31 31
SUBDIRS (ogr_converter)
32

  
33
SUBDIRS (ossimplanet)
src/gui/qgisinterface.h (working copy)
25 25
class QDockWidget;
26 26
class QMainWindow;
27 27
class QWidget;
28
class QTabWidget;
29
class QIcon;
28 30
#include <QObject>
29 31
#include <QPair>
30 32

  
......
104 106
    /** Return a pointer to the map canvas */
105 107
    virtual QgsMapCanvas * mapCanvas() = 0;
106 108

  
109
    /** Return a pointer to the main tab widget */
110
    virtual QTabWidget * tabWidget() = 0;
111

  
107 112
    /** Return a pointer to the main window (instance of QgisApp in case of QGIS) */
108 113
    virtual QWidget * mainWindow() = 0;
109 114

  
......
121 126
    /** Remove specified dock widget from main window (doesn't delete it). Added in QGIS 1.1. */
122 127
    virtual void removeDockWidget( QDockWidget * dockwidget ) = 0;
123 128

  
129
    /** Add a tab widget to the main window with label */
130
    virtual void addTabWidget( QWidget *page, const QString &label ) = 0;
131

  
132
    /** Add a tab widget to the main window with icon and label */
133
    virtual void addTabWidget( QWidget *page, const QIcon &icon, const QString &label ) = 0;
134

  
135
    /** Insert a tab widget to the main window with label */
136
    virtual void insertTabWidget( int index, QWidget *page, const QString &label ) = 0;
137

  
138
    /** Insert a tab widget to the main window with icon and label */
139
    virtual void insertTabWidget( int index, QWidget *page, const QIcon &icon, const QString &label ) = 0;
140

  
141
    /** Remove specified dock widget from main window (doesn't delete it). Added in QGIS 1.1. */
142
    virtual void removeTabWidget( int index ) = 0;
143

  
124 144
    /** refresh the legend of a layer */
125 145
    virtual void refreshLegend( QgsMapLayer *l ) = 0;
126 146