MCPcopy Create free account
hub / github.com/Inokinoki/QEFIEntryManager / QFilePathWidget

Method QFilePathWidget

qefidpfields.cpp:247–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245
246public:
247 explicit QFilePathWidget(QWidget *parent = nullptr)
248 : QWidget(parent)
249 {
250 QHBoxLayout *layout = new QHBoxLayout(this);
251 layout->setContentsMargins(0, 0, 0, 0);
252
253 m_lineEdit = new QLineEdit(this);
254 m_lineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
255 m_lineEdit->setPlaceholderText("Enter file path or click Browse File...");
256
257 m_browseButton = new QPushButton("Browse File...", this);
258 m_browseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
259
260 connect(m_browseButton, &QPushButton::clicked, this, [this]() {
261 // Placeholder: File selection dialog would go here
262 // QString path = QFileDialog::getOpenFileName(this, tr("Select File"), m_lineEdit->text());
263 // if (!path.isEmpty()) {
264 // m_lineEdit->setText(path);
265 // }
266 });
267
268 layout->addWidget(m_lineEdit, 1); // Stretch factor 1 for line edit
269 layout->addWidget(m_browseButton, 0); // No stretch for button
270 setLayout(layout);
271 }
272
273 void setPath(const QString &path) {
274 m_lineEdit->setText(path);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected