当前位置:网站首页>How to copy and paste QT? (QClipboard)
How to copy and paste QT? (QClipboard)
2022-07-26 00:55:00 【Licht powder】
Here we use QMenu Menu bar to show examples :
QMenu *m_ProgramBtnGroupMenu;
QAction *m_CopyEffectAction;Add operation :
m_ProgramBtnGroupMenu = new QMenu(this);
m_ProgramBtnGroupMenu->addAction(tr(" Copy "), this, SLOT(slotProgramGroupCopy()));
m_CopyEffectAction = m_ProgramBtnGroupMenu->addAction(tr(" Paste "), this, SLOT(slotProgramGroupPost()));
m_CopyEffectAction->setEnabled(false);// Add this sentence , Before copying , The paste is gray
// Restore the operation of the paste button here
connect(QApplication::clipboard(),SIGNAL(dataChanged()), this, SLOT(slotClipDataChange()));void LightEditWidget::slotClipDataChange()
{
QClipboard* clipboard = QApplication::clipboard();
if(clipboard->text().isEmpty()){
m_CopyEffectAction->setEnabled(false);
}else{
m_CopyEffectAction->setEnabled(true);
}
}Copy :
QClipboard* clipboard = QApplication::clipboard();
int iSelectProgramIndex = m_iProgramBtnIndex;
int iStep = m_iCurStep;
QString sText = QString("%1%2").arg(iSelectProgramIndex).arg(iStep);
clipboard->setText(sText);// The content written here is the content pasted later , According to their own needs Get the contents of the pasteboard :
QClipboard* clipboard = QApplication::clipboard();
QString sText = clipboard->text(QClipboard::Clipboard);边栏推荐
- Crawler small operation
- 【RTOS训练营】I2C和UART知识和预习安排 + 晚课提问
- Ssd7 | embedded friendly target detection network, product landing
- Force deduction record: Sword finger offer (2) -- jz13-22
- We have no way out
- Solve the problem that when the background image is set to be 100% full, when the horizontal scroll bar appears in the zoom browser, the part of the background image beyond the scroll bar is not full
- Hcip day 11
- [RTOS training camp] task scheduling (Continued), task comity, scheduling summary, queue and evening class questions
- Leetcode notes 121. the best time to buy and sell stocks
- jupyter更改默认浏览器的方法
猜你喜欢

Tarjan finds the strongly connected component o (n+m), shrinking point

Talk about "people" in the R & D team

【RTOS训练营】晚课学员问题

我们没有退路了

AI knows everything: build and deploy sign language recognition system from 0

EasyCVR页面添加Loading加载效果的实现过程

HCIP第十二天

Using questpdf operation to generate PDF is faster and more efficient!

YOLOV3

Suddenly found an optimization artifact
随机推荐
Unityvr robot Scene 3 gripper
YOLOV2 YOLO9000
【IJCAI 2022】参数高效的大模型稀疏训练方法,大幅减少稀疏训练所需资源
HCIP第十二天
MMOCR使用指南
Day06 MySql知识点总结
Travel + strategy accelerated landing, jietu new product matrix exposure
How to choose social e-commerce model in the early stage? Taishan crowdfunding
Talk about "people" in the R & D team
Django database addition, deletion, modification and query
We have no way out
ShardingSphere数据分片
el-table滚动条设置
[IJCAI 2022] parameter efficient large model sparse training method, which greatly reduces the resources required for sparse training
2022/7/19 exam summary
LCA three postures (multiplication, tarjan+ joint search set, tree chain dissection)
Distributed transaction and at mode principle of Seata
C language_ The use and implementation of string comparison function StrCmp
[GOM engine] script setting method for dummy configuration
力扣记录:剑指offer(2)——JZ13-22