Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
d112baae
Commit
d112baae
authored
13 years ago
by
Otmane Lahlou
Browse files
Options
Downloads
Patches
Plain Diff
ADD: Qtwidget for a directory parameter
parent
2e29abff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.cxx
+89
-0
89 additions, 0 deletions
...rappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.cxx
Code/Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.h
+65
-0
65 additions, 0 deletions
.../Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.h
with
154 additions
and
0 deletions
Code/Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.cxx
0 → 100644
+
89
−
0
View file @
d112baae
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include
"otbWrapperQtWidgetDirectoryParameter.h"
namespace
otb
{
namespace
Wrapper
{
QtWidgetDirectoryParameter
::
QtWidgetDirectoryParameter
(
DirectoryParameter
*
param
,
QtWidgetModel
*
m
)
:
QtWidgetParameterBase
(
param
,
m
),
m_DirectoryParam
(
param
)
{
}
QtWidgetDirectoryParameter
::~
QtWidgetDirectoryParameter
()
{
}
void
QtWidgetDirectoryParameter
::
DoUpdateGUI
()
{
}
void
QtWidgetDirectoryParameter
::
DoCreateWidget
()
{
// Set up input text edit
m_HLayout
=
new
QHBoxLayout
;
m_HLayout
->
setSpacing
(
0
);
m_HLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
m_Input
=
new
QLineEdit
;
m_Input
->
setToolTip
(
m_DirectoryParam
->
GetDescription
()
);
connect
(
m_Input
,
SIGNAL
(
textChanged
(
const
QString
&
)),
this
,
SLOT
(
SetFileName
(
const
QString
&
))
);
connect
(
m_Input
,
SIGNAL
(
textChanged
(
const
QString
&
)),
GetModel
(),
SLOT
(
NotifyUpdate
())
);
m_HLayout
->
addWidget
(
m_Input
);
// Set up input text edit
m_Button
=
new
QPushButton
;
m_Button
->
setText
(
"..."
);
m_Button
->
setToolTip
(
"Select d Directory..."
);
m_Button
->
setMaximumWidth
(
m_Button
->
width
());
connect
(
m_Button
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
SelectFile
())
);
m_HLayout
->
addWidget
(
m_Button
);
this
->
setLayout
(
m_HLayout
);
}
void
QtWidgetDirectoryParameter
::
SelectFile
()
{
QFileDialog
fileDialog
;
fileDialog
.
setConfirmOverwrite
(
true
);
fileDialog
.
setFileMode
(
QFileDialog
::
Directory
);
fileDialog
.
setNameFilter
(
"Select a Directory"
);
if
(
fileDialog
.
exec
())
{
this
->
SetFileName
(
fileDialog
.
selectedFiles
().
at
(
0
));
m_Input
->
setText
(
fileDialog
.
selectedFiles
().
at
(
0
));
}
}
void
QtWidgetDirectoryParameter
::
SetFileName
(
const
QString
&
value
)
{
// save value
m_DirectoryParam
->
SetValue
(
value
.
toStdString
());
// notify of value change
QString
key
(
QString
::
fromStdString
(
m_DirectoryParam
->
GetKey
())
);
emit
ParameterChanged
(
key
);
}
}
}
This diff is collapsed.
Click to expand it.
Code/Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.h
0 → 100644
+
65
−
0
View file @
d112baae
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbWrapperQtWidgetDirectoryParameter_h
#define __otbWrapperQtWidgetDirectoryParameter_h
#include
<QtGui>
#include
"otbWrapperDirectoryParameter.h"
#include
"otbWrapperQtWidgetParameterBase.h"
namespace
otb
{
namespace
Wrapper
{
/** \class
* \brief
*/
class
QtWidgetDirectoryParameter
:
public
QtWidgetParameterBase
{
Q_OBJECT
public:
QtWidgetDirectoryParameter
(
DirectoryParameter
*
,
QtWidgetModel
*
);
virtual
~
QtWidgetDirectoryParameter
();
protected
slots
:
void
SetFileName
(
const
QString
&
value
);
void
SelectFile
();
private:
QtWidgetDirectoryParameter
(
const
QtWidgetDirectoryParameter
&
);
//purposely not implemented
void
operator
=
(
const
QtWidgetDirectoryParameter
&
);
//purposely not implemented
virtual
void
DoCreateWidget
();
virtual
void
DoUpdateGUI
();
DirectoryParameter
::
Pointer
m_DirectoryParam
;
QHBoxLayout
*
m_HLayout
;
QLineEdit
*
m_Input
;
QPushButton
*
m_Button
;
};
}
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment