ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
ecvQtHelpers.h
Go to the documentation of this file.
1
// ----------------------------------------------------------------------------
2
// - CloudViewer: www.cloudViewer.org -
3
// ----------------------------------------------------------------------------
4
// Copyright (c) 2018-2024 www.cloudViewer.org
5
// SPDX-License-Identifier: MIT
6
// ----------------------------------------------------------------------------
7
8
#pragma once
9
10
// Qt
11
#include <QAbstractButton>
12
#include <QThread>
13
14
class
ccQtHelpers
{
15
public
:
17
inline
static
void
SetButtonColor
(QAbstractButton* button,
18
const
QColor& col) {
19
if
(button)
20
button->setStyleSheet(
21
QString(
"* { background-color: rgb(%1,%2,%3) }"
)
22
.arg(col.red())
23
.arg(col.green())
24
.arg(col.blue()));
25
}
26
28
static
int
GetMaxThreadCount
(
int
idealThreadCount) {
29
if
(idealThreadCount <= 4) {
30
return
idealThreadCount;
31
}
else
if
(idealThreadCount <= 8) {
32
return
idealThreadCount - 1;
33
}
else
{
34
return
idealThreadCount - 2;
35
}
36
}
37
39
static
int
GetMaxThreadCount
() {
40
return
GetMaxThreadCount
(QThread::idealThreadCount());
41
}
42
};
ccQtHelpers::SetButtonColor
static void SetButtonColor(QAbstractButton *button, const QColor &col)
Sets a button background color.
Definition:
ecvQtHelpers.h:17
ccQtHelpers::GetMaxThreadCount
static int GetMaxThreadCount()
Returns the ideal number of threads/cores with Qt Concurrent.
Definition:
ecvQtHelpers.h:39
ccQtHelpers
Definition:
ecvQtHelpers.h:14
ccQtHelpers::GetMaxThreadCount
static int GetMaxThreadCount(int idealThreadCount)
Returns the ideal number of threads/cores.
Definition:
ecvQtHelpers.h:28
libs
CVPluginAPI
include
ecvQtHelpers.h
Generated on Wed Nov 18 2026 14:48:07 for ACloudViewer by
1.8.17