mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:30:04 +00:00 
			
		
		
		
	Initial layer model for layer manager
This commit is contained in:
		
							parent
							
								
									ad55ec7f51
								
							
						
					
					
						commit
						f0822205a4
					
				
					 6 changed files with 504 additions and 3 deletions
				
			
		|  | @ -1,6 +1,7 @@ | |||
| #include "layer_dialog.hpp" | ||||
| #include "ui_layer_dialog.h" | ||||
| 
 | ||||
| #include <scwx/qt/model/layer_model.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
|  | @ -16,16 +17,41 @@ static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | |||
| class LayerDialogImpl | ||||
| { | ||||
| public: | ||||
|    explicit LayerDialogImpl() {} | ||||
|    explicit LayerDialogImpl(LayerDialog* self) : | ||||
|        layerModel_ {new model::LayerModel(self)} | ||||
|    { | ||||
|    } | ||||
|    ~LayerDialogImpl() = default; | ||||
| 
 | ||||
|    model::LayerModel* layerModel_; | ||||
| }; | ||||
| 
 | ||||
| LayerDialog::LayerDialog(QWidget* parent) : | ||||
|     QDialog(parent), | ||||
|     p {std::make_unique<LayerDialogImpl>()}, | ||||
|     p {std::make_unique<LayerDialogImpl>(this)}, | ||||
|     ui(new Ui::LayerDialog) | ||||
| { | ||||
|    ui->setupUi(this); | ||||
| 
 | ||||
|    ui->layerTreeView->setModel(p->layerModel_); | ||||
| 
 | ||||
|    auto layerViewHeader = ui->layerTreeView->header(); | ||||
| 
 | ||||
|    layerViewHeader->setMinimumSectionSize(10); | ||||
| 
 | ||||
|    // Enabled columns have a fixed size (checkbox)
 | ||||
|    layerViewHeader->setSectionResizeMode( | ||||
|       static_cast<int>(model::LayerModel::Column::EnabledMap1), | ||||
|       QHeaderView::ResizeMode::ResizeToContents); | ||||
|    layerViewHeader->setSectionResizeMode( | ||||
|       static_cast<int>(model::LayerModel::Column::EnabledMap2), | ||||
|       QHeaderView::ResizeMode::ResizeToContents); | ||||
|    layerViewHeader->setSectionResizeMode( | ||||
|       static_cast<int>(model::LayerModel::Column::EnabledMap3), | ||||
|       QHeaderView::ResizeMode::ResizeToContents); | ||||
|    layerViewHeader->setSectionResizeMode( | ||||
|       static_cast<int>(model::LayerModel::Column::EnabledMap4), | ||||
|       QHeaderView::ResizeMode::ResizeToContents); | ||||
| } | ||||
| 
 | ||||
| LayerDialog::~LayerDialog() | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ class LayerDialogImpl; | |||
| class LayerDialog : public QDialog | ||||
| { | ||||
|    Q_OBJECT | ||||
|    Q_DISABLE_COPY_MOVE(LayerDialog) | ||||
| 
 | ||||
| public: | ||||
|    explicit LayerDialog(QWidget* parent = nullptr); | ||||
|  |  | |||
|  | @ -36,7 +36,14 @@ | |||
|        <number>0</number> | ||||
|       </property> | ||||
|       <item> | ||||
|        <widget class="QTreeView" name="layerTreeView"/> | ||||
|        <widget class="QTreeView" name="layerTreeView"> | ||||
|         <property name="alternatingRowColors"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|         <property name="selectionMode"> | ||||
|          <enum>QAbstractItemView::ContiguousSelection</enum> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item> | ||||
|        <widget class="QFrame" name="frame_2"> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat