-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://gitee.com/opguess/QSyncUi
- Loading branch information
Showing
17 changed files
with
162 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "dircardproxy.h" | ||
|
||
#include"DirCard.h" | ||
#include<QVBoxLayout> | ||
|
||
DirCardProxy::DirCardProxy(QWidget *parent) : QWidget(parent) { | ||
parentWidget = qobject_cast<QWidget*>(parent); | ||
filesLayout=new QVBoxLayout(this); | ||
} | ||
|
||
DirCardProxy::~DirCardProxy() { | ||
cardMap.clear(); | ||
} | ||
|
||
void DirCardProxy::addDirCard(DirCard *card, const QString &id) { | ||
if (card && parentWidget && !cardMap.contains(id)) { | ||
cardMap[id] = card; | ||
// 在这里可以将card添加到UI中,例如使用布局管理器 | ||
/*QVBoxLayout *layout = qobject_cast<QVBoxLayout*>(parentWidget->layout()); | ||
layout->setAlignment(Qt::AlignTop); | ||
if (layout) { | ||
layout->addWidget(card); | ||
}*/ | ||
filesLayout->addWidget(card); | ||
filesLayout->setAlignment(Qt::AlignTop); | ||
} | ||
} | ||
|
||
void DirCardProxy::removeDirCard(const QString &id) { | ||
if (cardMap.contains(id)) { | ||
DirCard *card = cardMap.take(id); | ||
// 在这里可以从UI中移除card | ||
filesLayout->removeWidget(card); | ||
card->setParent(nullptr); | ||
card->deleteLater(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef DIRCARDPROXY_H | ||
#define DIRCARDPROXY_H | ||
|
||
#include <QMap> | ||
#include <QWidget> | ||
|
||
class DirCard; | ||
class QVBoxLayout; | ||
class DirCardProxy : public QWidget { | ||
Q_OBJECT | ||
public: | ||
explicit DirCardProxy(QWidget *parent = nullptr); | ||
~DirCardProxy() override; | ||
|
||
void addDirCard(DirCard *card, const QString &id); | ||
void removeDirCard(const QString &id); | ||
QVBoxLayout*filesLayout; | ||
|
||
private: | ||
QMap<QString, DirCard*> cardMap; | ||
QWidget *parentWidget; | ||
}; | ||
|
||
#endif // DIRCARDPROXY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.