我有一个窗口,其中包含所有按钮,还有一些隐藏的按钮.
现在我希望从另一个对话框中将set visibility设置为true.
怎么做?我用谷歌搜索了它,但我无法解决这个问题.
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "rams.h"
#include "abtdev.h"
#include "syllabus.h"
#include "login.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
QMainWindow::showFullScreen();
**ui->but_save->setHidden(true);
ui->but_delete1->setHidden(true);
ui->but_delete2->setHidden(true);
ui->but_upload1->setHidden(true);
ui->but_upload2->setHidden(true);**
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_but_abt_clicked()
{
abtdev a;
a.exec();
}
void MainWindow::on_but_Syllabus_clicked()
{
syllabus s;
s.showFullScreen();
s.exec();
}
void MainWindow::on_but_admin_clicked()
{
login objlogin;
objlogin.exec();
}
void MainWindow::on_but_rams_clicked()
{
// rams ramswin;
// ramswin.showFullScreen();
// ramswin.exec();
}
Run Code Online (Sandbox Code Playgroud)
我希望它在此对话框完成后显示!
#include "login.h"
#include "ui_login.h"
#include<QTimer>
#include "mainwindow.h" …Run Code Online (Sandbox Code Playgroud) int a[4] = {10,20,30,40};
std::vector<int> vec(4);
std::copy(a, a + 4, vec.begin());
Run Code Online (Sandbox Code Playgroud)
我在vc ++中遇到以下错误,它显示警告,但标记为错误,我该如何解决?
严重性代码说明项目文件行抑制状态错误C4996
std::copy::_Unchecked_iterators::_Deprecate:std::copy使用可能不安全的参数进行调用-此调用依赖于调用者检查传递的值是否正确。要禁用此警告,请使用-D_SCL_SECURE_NO_WARNINGS。请参阅有关如何使用Visual C ++“检查的迭代器” ConsoleApplication3的文档:e:\ programs \ vc \ include \ xutility 2372
我正在使用 Visual Studio 使用 C++ 开发一个控制台项目,其中鼠标正在执行所有输入操作。它在 Windows 7 上运行良好,但在 Windows 10 上运行不正常。
我将向您展示我的实际代码的一些代码,这是一个非常简单的版本。但这里是一样的:在 win7 上工作,而不是在 win 1 上工作
#include <stdio.h>
#include <windows.h>
void MouseEventProc(MOUSE_EVENT_RECORD);
VOID ResizeEventProc(WINDOW_BUFFER_SIZE_RECORD);
VOID KeyEventProc(KEY_EVENT_RECORD);
VOID GetInputEvents(VOID);
void gotoxy(int, int);
void MyErrorExit(char *s)
{
printf("Fatal: %s\n", s);
exit(1);
}
int main(void)
{
HANDLE hStdin;
DWORD cNumRead, fdwMode, fdwSaveOldMode, i;
INPUT_RECORD irInBuf[128];
// Get the standard input handle.
hStdin = GetStdHandle(STD_INPUT_HANDLE);
if (hStdin == INVALID_HANDLE_VALUE)
MyErrorExit("GetStdHandle");
// Save the current input mode, to be restored on exit.
if …Run Code Online (Sandbox Code Playgroud) 所以,我试图这样使用CArray:
CArray<CPerson,CPerson&> allPersons;
int i=0;
for(int i=0;i<10;i++)
{
allPersons.SetAtGrow(i,CPerson(i));
i++;
}
Run Code Online (Sandbox Code Playgroud)
但在编译我的程序时,我收到此错误:
"错误C2248:'CObject :: CObject':无法访问类'CObject'中声明的私有成员c:\ program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h"
我甚至不知道这是从哪里来的.
救命!
我习惯于构建 C++ 程序并在 Cython 中获取它,但在这里我试图获取 C++ 11array并且它绝对不起作用。
这是我的 .pxd :
cdef extern from "<array>" namespace "std" nogil :
cdef cppclass array[T, size_t]:
ctypedef T value_type
cppclass iterator:
T& operator*()
iterator operator++()
iterator operator--()
iterator operator+(size_t)
iterator operator-(size_t)
bint operator==(iterator)
bint operator!=(iterator)
bint operator<(iterator)
bint operator>(iterator)
bint operator<=(iterator)
bint operator>=(iterator)
T& operator[](size_t)
array() except +
array(array&) except +
Run Code Online (Sandbox Code Playgroud)
这个文件的大部分内容是从“vector.pxd”改编的,但我删除了分配器,因为 c++11array不需要它。我用作size_t第二个模板参数,但我不确定。
问题是,当我这样做时:
from array11 cimport array
cdef array[int, 5] test
Run Code Online (Sandbox Code Playgroud)
我得到,编译时:
模板参数中的未知类型
如果我做 :
from array11 …Run Code Online (Sandbox Code Playgroud) 我有大文件,包含少量大数据集.每个数据集包含一个名称和数据集大小(以字节为单位),允许跳过它并转到下一个数据集.
我想非常快速地建立数据集名称的索引.文件示例大约21MB,包含88个数据集.通过使用std::ifstream和seekg()在数据集之间跳过快速读取88个名称需要大约1300毫秒,我想减少.
事实上,我正在读取大约30个字节的88个块,在21MB文件中的给定位置,需要1300ms.
有没有办法改善这一点,还是操作系统和文件系统限制?我在Windows 7 64bit下运行测试.
我知道在文件开头有一个完整的索引会更好,但文件格式没有这个,我们无法改变它.
我有一个uint64_t值代表自纪元以来的纳秒。现在我需要将其转换为time_point.
目前我有这个代码:
std::chrono::time_point<std::chrono::nanoseconds> uptime(std::chrono::nanoseconds(deviceUptime));
Run Code Online (Sandbox Code Playgroud)
后来我想打印类似的东西Fri Feb 10 15:13:04 2017。为此,我想使用此代码:
std::time_t t = std::chrono::system_clock::to_time_t(uptime);
std::cout << "Device time: " << std::ctime(&t) << std::endl;
Run Code Online (Sandbox Code Playgroud)
但我收到一个错误:
No viable conversion from 'time_point<std::chrono::nanoseconds>' to 'const time_point<std::__1::chrono::system_clock>'
Run Code Online (Sandbox Code Playgroud)
我必须做什么才能将 转换为可以使用time_point的格式ctime?或者有没有更好的方法来解决这个问题?
我无法理解这个三元运算符的转换逻辑(这里是一个例子):
#include <iostream>
#include <typeinfo>
#include <unistd.h>
#include <cxxabi.h>
#include <climits>
template<typename T>
struct singletime
{
private:
T value;
public:
T& operator()() {return this->value;}
operator const T& () const {return value;}
unsigned char flag_needed_for_all_types;
};
static void getvalue1 (uint64_t value, const char *call)
{
std::cout << call << ": \t" << value << std::endl << std::endl;
}
#define getvalue(x, str) \
std::cout << typeid(x).name() << std::endl; \
getvalue1(x, str);
int main (int argc, char *argv[])
{
bool flag = true; …Run Code Online (Sandbox Code Playgroud) 如果我们有这样的函数:
int* foo()
{
int *x;
x = new int;
delete x;
return x;
}
Run Code Online (Sandbox Code Playgroud)
我们需要在函数中返回一个指针,但我们学到的是我们需要在final中删除一个空格.
如果我们先按x上面那样删除,那么x在最后一行返回是否有意义?因为x不再存在了.
但是如果我们x在返回之前没有删除,那么函数就会完成.
我们怎么办?或者我们真的不需要删除在内存中分配的空间?
阅读hana的教程,我想知道如何static_assert按预期工作:
template <typename Any>
auto switch_(Any& a) {
return [&a](auto ...cases_) {
auto cases = hana::make_tuple(cases_...);
auto default_ = hana::find_if(cases, [](auto const& c) {
return hana::first(c) == hana::type_c<default_t>;
});
static_assert(default_ != hana::nothing,
"switch is missing a default_ case");
// ...
};
}
Run Code Online (Sandbox Code Playgroud)
文档明确声明default_不是constexpr对象,因此,即使operator!=这些类型的重载是constexpr函数,表达式default_ != hana::nothing也不能是常量表达式,因为它的一个参数不是.
教程说:
请注意我们如何在没有任何内容的情况下使用static_assert进行比较的结果,即使它
default_是一个非constexpr对象?大胆地说,Hana确保在运行时没有丢失编译时已知的信息,这显然是案例存在的default_情况.
教程在该段落中引用了什么,或者该表达式如何工作?
c++ ×10
c++11 ×2
arrays ×1
c++-chrono ×1
console ×1
constexpr ×1
copy ×1
cython ×1
file ×1
mfc ×1
qt ×1
qt-creator ×1
qt5 ×1
templates ×1
time ×1
visual-c++ ×1
windows-10 ×1