C++
3
Вклад в тег
$data = ["image" => file_get_contents($URL)];
CURLOPT_POSTFIELDS($curl, $data);
$image = [];
$image['path'] = 'path\tmp\file.jpg';
$image['type'] = "image/jpeg";
$image['name'] = "file.jpg";
$data = ["image" => new CURLFile($image['path'], $image['type'], $image['name'])];
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
template<class NODE>
class NodeContainer {
public:
NodeContainer(NODE *n) :
node(n)
{
static_assert(std::is_base_of<NodeBase, NODE>::value, "Derived class not derived from NodeBase");
}
NODE* node;
void SomeActionOnNode() {}
};
property int minimumWidth: minimumWidth
ComboBox {
id: comboBox
width: minimumWidth
model: ["Пример очень длинного текста", "Текст 2"]
}
Component.onCompleted: minimumWidth = resizeComboBox(comboBox)
function resizeComboBox(id) {
var w = 0;
if(id.count === 0)
return id.width;
var original_index = id.currentIndex;
if(original_index < 0)
return id.width;
do {
w = Math.max(w, id.contentItem.contentWidth);
id.currentIndex = (id.currentIndex + 1) % id.count;
} while(id.currentIndex !== original_index)
return w + id.contentItem.leftPadding + id.contentItem.rightPadding + id.indicator.width;
}