void MainWindow::addRadioToUI()
{ int button_cunter=4;
while(!database.isEmpty())
{ button_cunter++;
QPushButton *one = new QPushButton("Play: "+name(get_r.getTrackId()));
one->setIcon(QIcon(":/images/play_button.png"));
one->setMaximumWidth(140);
one->setFlat(true);
QGroupBox* get_rGB = new QGroupBox("somethink");
QFormLayout* layout = new QFormLayout;
if(button_cunter%5 == 0){
layout->addWidget(one);
}
get_rGB->setLayout(layout);
scrollAreaWidgetContents->layout()->addWidget(get_rGB);
}
}
Run Code Online (Sandbox Code Playgroud)
我有几个自动添加的QPushButtons.有没有办法在按钮上添加"id属性或者其他",然后知道点击了哪个按钮?我对每个按钮都有不同的动作.
我有3个div,每个都有position: absolute.
首先是标题,它的工作.
标题具有恒定的高度,第二个div"内容"也有效.
第三个div是"页脚".
"内容"具有可变高度,当"内容"高于网络浏览器窗口时,"页脚"为"内容".无论内容高度如何,我都希望在"内容"下"页脚".
我的标题是300px高度,内容有margin-top: 300px.我不能对页脚使用相同的内容,因为内容没有恒定的高度.
我不想设置一个div position: absolute,这三个div放在这个div里面.
div#header{
width: 960px;
height: 200px;
left: 50%;
margin-left: -480px;
position: absolute;
}
div#content{
width: 960px;
border: 1px solid black;
left: 50%;
margin-left: -480px;
position: absolute;
margin-top: 200px;
}
div#footer{
width: 960px;
height: 30px;
left: 50%;
margin-left: -480px;
position: absolute;
bottom: 10px; /*with this i've div fixed to the bottom of web-browsers' window */
clear: both;
}
Run Code Online (Sandbox Code Playgroud) 我在drawable-xhdpi中有15个图像,每个都是800x800,在drawable-hdpi中我有相同的图像但600x600,当我在设备上运行hdpi分辨率的应用程序时,堆大小约为3mb,但是当我在设备上运行它时使用xhdpi分辨率,堆大小超过40mb,我得到了outofmemory?怎么了?图像太大了吗?
堆大小:ldpi:~3mb mdpi:~3mb hdpi:~3mb xhdpi:~40mb
以这种方式加载图像:
b1 = BitmapFactory.decodeResource(getResources(), R.drawable.image);
imageview.setImageBitmap(b1);
then in OnBackPressed() b1.recycle()
Run Code Online (Sandbox Code Playgroud)